I took the following example test:
public void testWelcomePage() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" );
..and changed it to point to my development site at http://localhost. This caused the test to bomb. This page has some javascript, which seams to be related to the exception. I have httpunit 1.6 running in jre 1.4.1_02
I got the following error I don't understand:
TypeError: Cannot convert null to an object. (httpunit; )
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:581)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:541)
at org.mozilla.javascript.NativeGlobal.typeError0(NativeGlobal.java:546)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:497)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:473)
at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:711)
at org.mozilla.javascript.gen.c25.call(httpunit:0)
at org.mozilla.javascript.gen.c25.exec(httpunit)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript(JavaScript.java:132)
at com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:65)
at com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:151)
at com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
at org.cyberneko.html.filters.DefaultFilter.endElement(Unknown Source)
at org.cyberneko.html.filters.NamespaceBinder.endElement(Unknown Source)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(Unknown Source)
at org.cyberneko.html.HTMLTagBalancer.endElement(Unknown Source)
at org.cyberneko.html.HTMLScanner$SpecialScanner.scan(Unknown Source)
at org.cyberneko.html.HTMLScanner.scanDocument(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:41)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:255)
at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1126)
at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:688)
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 com.auditIntegrity.views.BasicHttpTest.testWelcomePage2(BasicHttpTest.java:50)
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:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HI,
I took the following example test:
public void testWelcomePage() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" );
WebResponse response = conversation.getResponse( request );
WebForm forms[] = response.getForms();
assertEquals( 1, forms.length );
assertEquals( 1, forms[0].getParameterNames().length );
assertEquals( "name", forms[0].getParameterNames()[0] );
}
..and changed it to point to my development site at http://localhost. This caused the test to bomb. This page has some javascript, which seams to be related to the exception. I have httpunit 1.6 running in jre 1.4.1_02
I got the following error I don't understand:
TypeError: Cannot convert null to an object. (httpunit; )
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:581)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:541)
at org.mozilla.javascript.NativeGlobal.typeError0(NativeGlobal.java:546)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:497)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:473)
at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:711)
at org.mozilla.javascript.gen.c25.call(httpunit:0)
at org.mozilla.javascript.gen.c25.exec(httpunit)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript(JavaScript.java:132)
at com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:65)
at com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:151)
at com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
at org.cyberneko.html.filters.DefaultFilter.endElement(Unknown Source)
at org.cyberneko.html.filters.NamespaceBinder.endElement(Unknown Source)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(Unknown Source)
at org.cyberneko.html.HTMLTagBalancer.endElement(Unknown Source)
at org.cyberneko.html.HTMLScanner$SpecialScanner.scan(Unknown Source)
at org.cyberneko.html.HTMLScanner.scanDocument(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:41)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:255)
at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1126)
at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:688)
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 com.auditIntegrity.views.BasicHttpTest.testWelcomePage2(BasicHttpTest.java:50)
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:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)