01: // Copyright © 2006-2007 ASERT. Released under the Canoo Webtest license.
02: package com.canoo.webtest.plugins.exceltest;
03:
04: import java.io.IOException;
05:
06: import com.canoo.webtest.ant.WebtestTask;
07: import com.canoo.webtest.steps.Step;
08:
09: /**
10: * Test class for {@link AbstractExcelStep}.<p>
11: *
12: * @author Rob Nielsen
13: */
14: public class AbstractExcelStepTest extends BaseExcelStepTestCase {
15:
16: protected Step createStep() {
17: return new AbstractExcelStepStub();
18: }
19:
20: public void testVerifyParametersWithoutPreviousPage() {
21: final Step step = getStep();
22: assertStepRejectsNullResponse(step);
23: }
24:
25: public void testNonExcel() throws IOException {
26: final Step step = getStep();
27: WebtestTask.setThreadContext(new ExcelContextStub("text/html"));
28: assertErrorOnExecute(step, "Non .xls file",
29: "File does not have correct content type (not a '.xls' file?): text/html");
30: }
31:
32: public void testNoFile() throws IOException {
33: final Step step = getStep();
34: WebtestTask.setThreadContext(new ExcelContextStub(
35: "application/vnd.ms-excel"));
36: assertErrorOnExecute(step, "Non .xls file",
37: "Could not open Excel file.");
38: }
39:
40: public void testToString() {
41: }
42:
43: private class AbstractExcelStepStub extends AbstractExcelStep {
44: public void doExecute() throws Exception {
45: getExcelWorkbook();
46: }
47: }
48: }
|