UIX Unit Test with HttpUnit
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.