Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UIX Unit Test with HttpUnit

445994Aug 19 2005
Hi

I would like to test my UIX pages with HttpUnit. I am always having an exception while trying to get a page. Here is my code:

package mypackage;
import com.meterware.httpunit.TableCell;
import com.meterware.httpunit.WebTable;
import junit.framework.TestCase;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
public class TestThree extends TestCase
{
public TestThree(String name)
{
super(name);
}
public void testTable() throws Exception
{
WebConversation webConversation = new WebConversation();
WebRequest request = new GetMethodWebRequest("http://localhost:8988/HttpUnitTest-View-context-root/table.do");

WebResponse response = webConversation.getResponse(request);

}

}



Here is the exception thrown:

ReferenceError: "event" is not defined.

at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)

at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:557)

at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1076)

at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2265)

at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:58)

at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:172)

at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)

at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:689)

at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:89)

at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEngineFactory.java:58)

at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44)

at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:122)

at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113)

at mypackage.TestThree.testSailorsTable(TestThree.java:19)

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 junit.framework.TestSuite.runTest(TestSuite.java:208)

at junit.framework.TestSuite.run(TestSuite.java:203)

at junit.swingui.TestRunner$16.run(TestRunner.java:623)

Any help would be welcomed.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2005
Added on Aug 19 2005
0 comments
116 views