Hi All,

I get the following error when executing my jWebUnit test case in eclipse.
It occurs when i click on the submit button of a simple form with 2 test fields.

---------------------

java.lang.RuntimeException: com.meterware.httpunit.ScriptException: Event 'return ValidateDeliveryFeeRate(this)' failed: org.mozilla._javascript_.EcmaError: TypeError: Cannot read property "jsValidation" from undefined (httpunit#12)
    at com.meterware.httpunit._javascript_._javascript_$_javascript_Engine.handleScriptException(_javascript_.java:202)
    at com.meterware.httpunit._javascript_._javascript_$_javascript_Engine.performEvent(_javascript_.java:175)
    at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
    at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
    at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
    at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
    at com.meterware.httpunit.SubmitButton.doButtonAction(SubmitButton.java:67)
    at com.meterware.httpunit.Button.click(Button.java:81)
    at net.sourceforge.jwebunit.HttpUnitDialog.submit(HttpUnitDialog.java:592)
    at net.sourceforge.jwebunit.WebTester.submit(WebTester.java:868)
    at net.sourceforge.jwebunit.WebTestCase.submit(WebTestCase.java:351)
    at net.sourceforge.jwebunit.esales.DeliveryFees.testSearch(DeliveryFees.java:100)
    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)

    at net.sourceforge.jwebunit.HttpUnitDialog.submit(HttpUnitDialog.java:595)
    at net.sourceforge.jwebunit.WebTester.submit(WebTester.java:868)
    at net.sourceforge.jwebunit.WebTestCase.submit(WebTestCase.java:351)
    at net.sourceforge.jwebunit.esales.DeliveryFees.testSearch(DeliveryFees.java:100)
    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)
-----------------------------------------------


My testcase looks like this:
---------------
        assertTextPresent( "Delivery Fees" );
        clickButtonWithText("Create New");

        gotoFrame( "main" );
        assertTextPresent( "Delivery Fee Details" );
       
        setFormElementWithLabel("Delivery Fee Name","111testDelivFee");
        setFormElementWithLabel("Description","111testDesc");
      
        submit("Update");  //error thrown after this statement

-----------------------------

My html source is like this
---------------
<form method="post" action=
"DeliveryFeeDetails.jsp" onSubmit="return ValidateDeliveryFeeRate(this)" >
<div class="entry_details">
<input type="hidden" value="Update" name="@ [EMAIL PROTECTED]" />
<div class="entry_detailsheader" >
<div class="entry_left">Details
</div>
</ div>
<div class="entry_detailsbody">
<table border="0" cellpadding=
"0" cellspacing="0" >
<tr >
< td class="entry_label">Delivery Fee Name</td>
<td class="entry_field"><input type="text" name="@[EMAIL PROTECTED]@comp.UpdateDeliveryFee" value="" size="40" onBlur="this.value=trimAll(this.value)" id ="txtDeliveryName" jsValidation= "{type:'text',mandatory:'true'}" /><span class="footnote" >&nbsp;*</span>&nbsp;</td>
</tr>
< tr >
<td class="entry_label">Description</ td>
<td class="entry_field"><input type="text" name="@[EMAIL PROTECTED]@comp.UpdateDeliveryFee " value="" size="40" onBlur="this.value=trimAll(this.value)" jsValidation= "{type:'text',mandatory:'true'}" /><span class="footnote">&nbsp;*</span>&nbsp;</ td>
</tr>
</table>
</div> <!-- end entry_detailsbody -->
</ div> <!-- end entry_details -->
<div class="entry_buttons">
<div class="entry_left">
<input type="button" value="Back" name="Back" onclick= "window.location='http://localhost:9080/e-Sales/esa-bc/DeliveryFeeSearch.jsp?';return (false);" class="entry_buttonleft" onmouseover="this.className='entry_buttonlefthover'" onmouseout="this.className='entry_buttonleft '" />
</div>
<div class="entry_right" >
<input type="reset" value= "Reset" name="Reset" class="entry_button" onmouseover="this.className='entry_buttonhover'" onmouseout="this.className='entry_button '" />
<input type="submit" value="Create" name="Update" class= "entry_button" onmouseover="this.className='entry_buttonhover'" onmouseout= "this.className='entry_button'" />
</div>

</div> <!-- end entry_buttons -->
</form>

-------------------

The problem seems to be the extra attribute "jaValidation" in the 2 extra text fields (in red), which is not recognized.

My Setup is:


jWebUnit 1.2
js.jar - 1.6R2
httpunit.jar - 1.6.2

Is there any work around for the problem ? I cannot change the code.

Waiting for your responses,

Regards,
Manjunath


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&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to