Update of /cvsroot/jwebunit/jWebUnit/test/net/sourceforge/jwebunit
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10672/test/net/sourceforge/jwebunit
Modified Files:
FormSubmissionTest.java AllTests.java
Log Message:
Fied FormSubmissionTest to use request+response, with no changes in test
coverage. Now included in AllTests. JSP compilation takes some time but is only
performed once per test suite execution. JSP compilation needs javac in path.
Index: FormSubmissionTest.java
===================================================================
RCS file:
/cvsroot/jwebunit/jWebUnit/test/net/sourceforge/jwebunit/FormSubmissionTest.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** FormSubmissionTest.java 15 Apr 2005 04:47:43 -0000 1.23
--- FormSubmissionTest.java 23 Dec 2005 11:01:40 -0000 1.24
***************
*** 29,40 ****
public void testSetInputField() {
! beginAt("/SingleNamedButtomForm.jsp");
setFormElement("color", "blue");
submit("button");
! assertTextPresent("Parms are: color=blue");
! beginAt("/QueryForm.html");
setFormElement("color", "red");
submit();
! assertTextPresent("Parms are: color=red");
}
--- 29,42 ----
public void testSetInputField() {
! beginAt("/SingleNamedButtonForm.html");
setFormElement("color", "blue");
submit("button");
! assertTextPresent("Submitted parameters");
! //dumpResponse(System.out);
! assertTextPresent("Params are: color=blue");
! clickLink("return");
setFormElement("color", "red");
submit();
! assertTextPresent("Params are: color=red");
}
***************
*** 44,48 ****
setFormElement("color", "blue");
submit();
! assertTextPresent("Parms are: color=blue&checkBox=on");
}
--- 46,50 ----
setFormElement("color", "blue");
submit();
! assertTextPresent("Params are: color=blue checkBox=on");
}
***************
*** 53,57 ****
checkCheckbox("checkBox", "3"); // check for duplicates
submit();
! assertTextPresent("Parms are: checkBox=1&checkBox=3");
}
--- 55,59 ----
checkCheckbox("checkBox", "3"); // check for duplicates
submit();
! assertTextPresent("Params are: checkBox=1,3 ");
}
***************
*** 62,66 ****
uncheckCheckbox("checkBox", "3");
submit();
! assertTextPresent("Parms are: checkBox=1");
}
--- 64,68 ----
uncheckCheckbox("checkBox", "3");
submit();
! assertTextPresent("Params are: checkBox=1");
}
***************
*** 68,81 ****
beginAt("/SingleNamedButtonForm.html");
checkCheckbox("checkBox");
setFormElement("color", "blue");
uncheckCheckbox("checkBox");
submit();
! assertTextPresent("Parms are: color=blue");
}
public void testSingleFormSingleUnnamedButtonSubmission() {
beginAt("/SingleUnnamedButtonForm.html");
submit();
! assertTextPresent("Parms are: color=blue");
}
--- 70,85 ----
beginAt("/SingleNamedButtonForm.html");
checkCheckbox("checkBox");
+ assertFormElementEquals("checkBox", "on");
setFormElement("color", "blue");
uncheckCheckbox("checkBox");
submit();
! assertTextPresent("Params are: color=blue ");
}
public void testSingleFormSingleUnnamedButtonSubmission() {
beginAt("/SingleUnnamedButtonForm.html");
+ setFormElement("color", "blue");
submit();
! assertTextPresent(" color=blue ");
}
***************
*** 84,88 ****
setFormElement("color", "red");
submit();
! assertTextPresent("Parms are: color=red");
}
--- 88,92 ----
setFormElement("color", "red");
submit();
! assertTextPresent("Params are: color=red");
}
***************
*** 90,97 ****
gotoMultiButtonPage();
submit("color");
! assertTextPresent("Parms are: color=red");
gotoMultiButtonPage();
submit("color", "blue");
! assertTextPresent("Parms are: color=blue");
}
--- 94,101 ----
gotoMultiButtonPage();
submit("color");
! assertTextPresent("Params are: color=red");
gotoMultiButtonPage();
submit("color", "blue");
! assertTextPresent("Params are: color=blue");
}
***************
*** 121,133 ****
public void testInvalidButton() {
! gotoMultiButtonPage();
try {
submit("button1");
} catch (RuntimeException e) {
! assertTrue(e.getMessage(), e.getMessage().indexOf(
"com.meterware.httpunit.HttpNotFoundException") != -1);
- return;
}
- fail("Should have failed");
}
--- 125,136 ----
public void testInvalidButton() {
! beginAt("/InvalidActionForm.html");
try {
submit("button1");
+ fail("Should have failed because the target page does not exist");
} catch (RuntimeException e) {
! assertTrue("Should return 404 error",
e.getMessage().indexOf(
"com.meterware.httpunit.HttpNotFoundException") != -1);
}
}
***************
*** 143,147 ****
setFormElement("param2", "anyvalue");
submit("button2b");
! assertTextPresent("param2=anyvalue&button2b=b2b");
}
--- 146,151 ----
setFormElement("param2", "anyvalue");
submit("button2b");
! assertTextPresent(" param2=anyvalue ");
! assertTextPresent(" button2b=b2b ");
}
***************
*** 168,172 ****
setFormElementWithLabel("Second", "anotherValue");
submit();
! assertTextPresent("param1=oneValue¶m2=anotherValue");
}
--- 172,177 ----
setFormElementWithLabel("Second", "anotherValue");
submit();
! assertTextPresent(" param1=oneValue ");
! assertTextPresent(" param2=anotherValue ");
}
***************
*** 176,180 ****
setFormElementWithLabel("Treat", "anotherValue");
submit();
! assertTextPresent("param3=oneValue¶m4=anotherValue");
}
--- 181,186 ----
setFormElementWithLabel("Treat", "anotherValue");
submit();
! assertTextPresent(" param3=oneValue ");
! assertTextPresent(" param4=anotherValue ");
}
***************
*** 183,203 ****
}
- private void addServletResource() {
- // addTargetResource("TargetPage", "color=blue");
- // addTargetResource("TargetPage", "color=red");
- // addTargetResource("TargetPage",
"color=blue&checkBox=on");
- // addTargetResource("TargetPage",
"color=blue&size=big");
- // addTargetResource("TargetPage",
"color=blue&size=small");
- // addTargetResource("TargetPage",
"param2=anyvalue");
- // addTargetResource("TargetPage",
"param4=anyvalue");
- // addTargetResource("TargetPage",
"param2=anyvalue&button2b=b2b");
- // addTargetResource("TargetPage",
"param2=anyvalue&button2a=b2a");
- // addTargetResource("TargetPage",
- // "param1=oneValue¶m2=anotherValue");
- // addTargetResource("TargetPage",
- // "param3=oneValue¶m4=anotherValue");
- // addTargetResource("TargetPage",
"checkBox=1&checkBox=3");
- // addTargetResource("TargetPage", "checkBox=1");
- }
-
}
\ No newline at end of file
--- 189,191 ----
Index: AllTests.java
===================================================================
RCS file:
/cvsroot/jwebunit/jWebUnit/test/net/sourceforge/jwebunit/AllTests.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** AllTests.java 22 Dec 2005 18:05:01 -0000 1.21
--- AllTests.java 23 Dec 2005 11:01:40 -0000 1.22
***************
*** 25,33 ****
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(NavigationTest.class);
-
- //major work. requires using jsp / servlet request response
cycles.
- //suite.addTestSuite(FormSubmissionTest.class);
-
suite.addTestSuite(WebAssertionsTest.class);
suite.addTestSuite(TestContextTest.class);
--- 25,30 ----
public static Test suite() {
TestSuite suite = new TestSuite();
+
suite.addTestSuite(NavigationTest.class);
suite.addTestSuite(WebAssertionsTest.class);
suite.addTestSuite(TestContextTest.class);
***************
*** 38,41 ****
--- 35,39 ----
suite.addTestSuite(TextAndElementWalkerTest.class);
suite.addTestSuite(TextAndElementWalkerReverseTest.class);
+ suite.addTestSuite(FormSubmissionTest.class);
suite.addTestSuite(FormSubmissionCheckboxesTest.class);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development