Update of /cvsroot/jwebunit/jWebUnit/test/net/sourceforge/jwebunit
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28084/test/net/sourceforge/jwebunit
Modified Files:
NavigationTest.java
Log Message:
Moved NavigationTest from TestServer to Jetty.
Index: NavigationTest.java
===================================================================
RCS file:
/cvsroot/jwebunit/jWebUnit/test/net/sourceforge/jwebunit/NavigationTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** NavigationTest.java 1 Sep 2003 19:55:08 -0000 1.13
--- NavigationTest.java 23 Aug 2004 22:13:44 -0000 1.14
***************
*** 1,29 ****
package net.sourceforge.jwebunit;
import junit.framework.AssertionFailedError;
/**
! * Test url navigation methods on WebTestCase (starting at a url, navigating links).
! *
* @author Jim Weaver
* @author Wilkes Joiner
*/
! public class NavigationTest extends JWebUnitTest {
public void setUp() throws Exception {
! super.setUp();
}
public void testBeginAt() {
- defineResource("/blah.html", "");
beginAt("/blah.html");
}
public void testForwardSlashConfusion() throws Exception {
- defineWebPage("/app/blah", "here");
- getTestContext().setBaseUrl(hostPath + "/app");
beginAt("/blah.html");
beginAt("blah.html");
! getTestContext().setBaseUrl(hostPath + "/app/");
beginAt("/blah.html");
beginAt("blah.html");
--- 1,38 ----
package net.sourceforge.jwebunit;
+ import net.sourceforge.jwebunit.util.JettySetup;
import junit.framework.AssertionFailedError;
+ import junit.framework.Test;
+ import junit.framework.TestSuite;
/**
! * Test url navigation methods on WebTestCase (starting at a url, navigating
! * links).
! *
* @author Jim Weaver
* @author Wilkes Joiner
*/
! public class NavigationTest extends WebTestCase {
!
! private String hostPath;
!
! public static Test suite() {
! Test suite = new TestSuite(NavigationTest.class);
! return new JettySetup(suite);
! }
public void setUp() throws Exception {
! hostPath = "http://localhost:8081/jwebunit";
! getTestContext().setBaseUrl(hostPath + "/NavigationTest");
}
public void testBeginAt() {
beginAt("/blah.html");
}
public void testForwardSlashConfusion() throws Exception {
beginAt("/blah.html");
beginAt("blah.html");
! getTestContext().setBaseUrl(hostPath + "/NavigationTest/");
beginAt("/blah.html");
beginAt("blah.html");
***************
*** 31,45 ****
public void testInvalidBeginAt() {
- defineResource("/", "");
try {
beginAt("/nosuchresource.html");
} catch (Throwable t) {
- return;
}
- fail("Expected exception");
}
public void testClickLinkWithText() {
! gotoLinkTestPage();
clickLinkWithText("an active link");
assertTitleEquals("targetPage");
--- 40,54 ----
public void testInvalidBeginAt() {
try {
beginAt("/nosuchresource.html");
+ fail("Expected exception");
} catch (Throwable t) {
}
}
public void testClickLinkWithText() {
! beginAt("/pageWithLink.html");
! assertTitleEquals("pageWithLink");
!
clickLinkWithText("an active link");
assertTitleEquals("targetPage");
***************
*** 47,55 ****
public void testClickLinkWithTextN() {
! gotoLinkTestPage();
clickLinkWithText("an active link", 0);
assertTitleEquals("targetPage");
beginAt("/pageWithLink.html");
clickLinkWithText("an active link", 1);
assertTitleEquals("targetPage2");
beginAt("/pageWithLink.html");
--- 56,68 ----
public void testClickLinkWithTextN() {
! beginAt("/pageWithLink.html");
! assertTitleEquals("pageWithLink");
!
clickLinkWithText("an active link", 0);
assertTitleEquals("targetPage");
+
beginAt("/pageWithLink.html");
clickLinkWithText("an active link", 1);
+
assertTitleEquals("targetPage2");
beginAt("/pageWithLink.html");
***************
*** 58,65 ****
fail();
} catch (AssertionFailedError expected) {
! assertEquals(
! "Link with text [an active link] and index 2 "
! + "not found in response.",
! expected.getMessage());
}
assertTitleEquals("pageWithLink");
--- 71,76 ----
fail();
} catch (AssertionFailedError expected) {
! assertEquals("Link with text [an active link] and index 2 "
! + "not found in response.", expected.getMessage());
}
assertTitleEquals("pageWithLink");
***************
*** 67,81 ****
public void testClickLinkWithTextAfterText() {
! defineWebPage("pageWithLink",
! "First: <a href=\"/targetPage1.html\">link text</a>\n" +
! "Second: <a href=\"/targetPage2.html\">link text</a>)\n");
! defineWebPage("targetPage1", "");
! defineWebPage("targetPage2", "");
!
! beginAt("/pageWithLink.html");
clickLinkWithTextAfterText("link text", "First:");
! assertTitleEquals("targetPage1");
! beginAt("/pageWithLink.html");
clickLinkWithTextAfterText("link text", "Second:");
assertTitleEquals("targetPage2");
--- 78,86 ----
public void testClickLinkWithTextAfterText() {
! beginAt("/pageWithLinkWithTextAfterText.html");
clickLinkWithTextAfterText("link text", "First:");
! assertTitleEquals("targetPage");
! beginAt("/pageWithLinkWithTextAfterText.html");
clickLinkWithTextAfterText("link text", "Second:");
assertTitleEquals("targetPage2");
***************
*** 83,87 ****
public void testClickLinkWithImage() {
! gotoLinkTestPage();
clickLinkWithImage("graphic.jpg");
assertTitleEquals("targetPage2");
--- 88,94 ----
public void testClickLinkWithImage() {
! beginAt("/pageWithLink.html");
! assertTitleEquals("pageWithLink");
!
clickLinkWithImage("graphic.jpg");
assertTitleEquals("targetPage2");
***************
*** 89,110 ****
public void testClickLinkByID() {
! gotoLinkTestPage();
clickLink("activeID");
assertTitleEquals("targetPage");
}
! private void gotoLinkTestPage() {
! defineWebPage("pageWithLink",
! "<a href=\"/targetPage.html\" id=\"activeID\">an <b>active</b>
link</A>\n" +
! "<a href=\"/targetPage2.html\"><img src=\"graphic.jpg\"/></a>)\n" +
! "<a href=\"/targetPage2.html\">an active <i>link</i></a>\n");
! defineWebPage("targetPage", "");
! defineWebPage("targetPage2", "");
beginAt("/pageWithLink.html");
assertTitleEquals("pageWithLink");
- }
- public void testInvalidClickLink() {
- gotoLinkTestPage();
try {
clickLinkWithText("no such link");
--- 96,110 ----
public void testClickLinkByID() {
! beginAt("/pageWithLink.html");
! assertTitleEquals("pageWithLink");
!
clickLink("activeID");
assertTitleEquals("targetPage");
}
! public void testInvalidClickLink() {
beginAt("/pageWithLink.html");
assertTitleEquals("pageWithLink");
try {
clickLinkWithText("no such link");
***************
*** 116,125 ****
public void testGotoPage() {
! defineWebPage("page1", "page1");
! defineWebPage("page2", "page2");
! beginAt("/page1.html");
! assertTitleEquals("page1");
! gotoPage("page2.html");
! assertTitleEquals("page2");
}
! }
--- 116,123 ----
public void testGotoPage() {
! beginAt("/targetPage.html");
! assertTitleEquals("targetPage");
! gotoPage("/targetPage2.html");
! assertTitleEquals("targetPage2");
}
! }
\ No newline at end of file
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Jwebunit-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development