Hi Dave,
I couldn't manage to reproduce your bug with the current SVN version.
Could you please try to use these libs :
http://jwebunit.sourceforge.net/jwebunit%20-%20httpunit.zip and see if
it still doesn't work.
++
Julien
David Bloom a écrit :
Hi there. I'm a newbie to jWebUnit, and I'm having a problem with the
assertFormPresent command. I've got a JSP page that generates an html
page that contains a form. I'm trying to write a test that ensures
that form exists as part of the html and can be sucessfully submitted.
I've written my initial test case which first check that the JSP page
is there, and then tries to test if a form exists within the page.
The test for the page existing passes, but the test for the form does
not. The problem is I can see that the form _is_ there when I view
the source of the page.
Here's my WebTestCase:
package net.web.wholesale.unittests.mills;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import net.sourceforge.jwebunit.*;
public class MillAdd extends WebTestCase {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TestRunner.run(new TestSuite(MillAdd.class));
}
public void setUp() throws Exception {
getTestContext().setBaseUrl("http://localhost");
}
public void testMillList() {
beginAt("MillList.jsp");
}
public void testMillListAddButton() {
beginAt("MillList.jsp");
assertFormPresent("addmill");
}
}
here's the trace of the failure:
junit.framework.AssertionFailedError: No form present with name or id
[addmill]
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at
net.sourceforge.jwebunit.WebTester.assertFormPresent(WebTester.java:361)
at
net.sourceforge.jwebunit.WebTestCase.assertFormPresent(WebTestCase.java:152)
at
net.web.wholesale.unittests.mills.MillAdd.testMillListAddButton(MillAdd.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
and here's the HTML that I get when I view source after hitting my JSP
page. The form is at the bottom:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Untitled Document</title>
<link type="text/css" rel="stylesheet" href="css/baillie.css" />
<link type="text/css" rel="stylesheet" href="css/calendar.css" />
<script language="javascript" type="text/javascript"
src="script/ajaxManager.js"></script>
<script language="javascript" type="text/javascript"
src="script/choosedate.js"></script>
<script language="javascript" type="text/javascript"
src="script/script.js"></script>
</head>
<body>
<div id="milllist" class="milllistbody">
<table class="milllistbodytable" width="100%" border="1"
bgcolor="#ffffff" bordercolor="#000000" cellpadding="2"
cellspacing="0">
<tr bgcolor="#CCCCCC">
<th width="25%">Short Name</th>
<th colspan="4">Mill Name</th>
</tr>
<tr>
<td align="center">Double Aught</td>
<td align="center">Double Aught Lumber, Inc.</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0000057')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0000057')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0000057', 'Double+Aught')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Haessly</td>
<td align="center">Haessly Hardwood Lumber Co.</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('9900098')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('9900098')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('9900098', 'Haessly')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Patterson</td>
<td align="center">Patterson Lumber Company</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0000154')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0000154')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0000154', 'Patterson')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Potter</td>
<td align="center">Potter Lumber Co., Inc.</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0000153')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0000153')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0000153', 'Potter')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Wightman</td>
<td align="center">Wightman Lumber Sales Corp.</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0001260')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0001260')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0001260', 'Wightman')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Clendenin</td>
<td align="center">Clendenin Yard</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0090005')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0090005')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0090005', 'Clendenin')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Leitchfield</td>
<td align="center">Leitchfield Yard</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0090004')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0090004')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0090004', 'Leitchfield')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Mark's Mill Display</td>
<td align="center">Mark's Mill</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('MARK1')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('MARK1')" align="center" title="Clone Mill"><img
style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('MARK1', 'Mark%27s+Mill+Display')"
align="center" title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Smyrna</td>
<td align="center">Smyrna Yard</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0090002')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0090002')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0090002', 'Smyrna')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">St. James</td>
<td align="center">St. James Yard</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0090023')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0090023')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0090023', 'St.+James')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Titusville</td>
<td align="center">Titusville Yard</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0090003')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0090003')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0090003', 'Titusville')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Waterloo</td>
<td align="center">Waterloo Yard</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0090001')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0090001')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0090001', 'Waterloo')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">World Wood</td>
<td align="center">World Wood Yard</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0090010')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0090010')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0090010', 'World+Wood')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Cascade Hardwoods</td>
<td align="center">Cascade Hardwoods</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0003755')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0003755')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0003755', 'Cascade+Hardwoods')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Hamer, Inc.</td>
<td align="center">Jim C. Hamer, Inc</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0001709')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0001709')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0001709', 'Hamer%2C+Inc.')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Indiana Hardwoods</td>
<td align="center">Indiana Hardwood Lbr. Co.</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('Indiana')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('Indiana')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('Indiana', 'Indiana+Hardwoods')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">P&W</td>
<td align="center">P&W Forest</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0004752')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0004752')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0004752', 'P%26W')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Timber Ridge</td>
<td align="center">Timber Ridge Lumber</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0003302')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0003302')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0003302', 'Timber+Ridge')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Walnut</td>
<td align="center">Walnut Street Hardwood, Inc.</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0000198')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0000198')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0000198', 'Walnut')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Locust</td>
<td align="center">Locust Industries</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0099133')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0099133')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0099133', 'Locust')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Denoon</td>
<td align="center">Denoon Lumber Company</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0000058')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0000058')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0000058', 'Denoon')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
<tr>
<td align="center">Haessly</td>
<td align="center">Haessly Hardwood Lumber Co.</td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillEdit('0000098')" align="center" title="Edit"><img
style="cursor: hand;" src="images/actionEdit.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillClone('0000098')" align="center" title="Clone
Mill"><img style="cursor: hand;" src="images/copy.gif"/></td>
<td style="border-left-width:0px;" width="5%"
onclick="doMillDelete('0000098', 'Haessly')" align="center"
title="Delete"><img style="cursor: hand;"
src="images/delete.gif"/></td>
</tr>
</table>
<table width="100%" cellpadding="2" cellspacing="0">
<form name="addmill" method="post" action="MillAddEdit.jsp">
<input type="hidden" name="action" value="add" />
<tr>
<td colspan="5" align="right"><input class="milladdeditbutton"
onmouseover="toggleStyle(this, 'milladdeditbutton_hover')"
onmouseout="toggleStyle(this, 'milladdeditbutton_hover')"
type="submit" value="Add Mill" /></td>
</tr>
</form>
</table>
</div>
</body>
</html>
Any ideas why this assertion is failing?
Thanks for any help!
-Dave
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
--
_________________________________________________________________________
Julien HENRY | **Capgemini Sud **| Nice
www.fr.capgemini.com <http://www.capgemini.com/>
Porte de l’Arénas – Entrée B | 455 Promenade des Anglais | 06200 Nice
**Join the Collaborative Business Experience**** **
_________________________________________________________________________
This message contains information that may be privileged or confidential and is
the property of the Capgemini Group. It is intended only for the person to whom
it is addressed. If you are not the intended recipient, you are not authorized
to read, print, retain, copy, disseminate, distribute, or use this message or
any part thereof. If you receive this message in error, please notify the
sender immediately and delete all copies of this message.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users