about testing jsp using cactus and httpunit
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gavin_Wang
Posted On:   Saturday, December 31, 2005 09:07 AM

I am using cactus and httpunit to test some jsp, my testcase class subclass JspTestCase, in endXXX(xxx.httpunit.WebResponse) I tried to access WebResponse.getLinks(), getForms(), etc.,but always get the following error: java.lang.IllegalStateException: Unable to retrieve script included by this response, since it was loaded by getResource(). Use getResponse() instead. at com.meterware.httpunit.ParsedHTML.getIncludedScript(ParsedHTML.java:356) at com.meterware.httpunit.ParsedHTML.getScript(ParsedHTML.java:339) at com.meterware.httpunit.ParsedHTML.interpretScriptElement(ParsedHTML.java:319) at com.meterware.httpunit.ParsedHTML.access$700(ParsedHTML.java:37) at com.meterware.httpunit.ParsedHTML$ScriptFa   More>>

I am using cactus and httpunit to test some jsp, my testcase class subclass JspTestCase, in endXXX(xxx.httpunit.WebResponse) I tried to access WebResponse.getLinks(), getForms(), etc.,but always get the following error:

			
java.lang.IllegalStateException: Unable to retrieve script included by this response, since it was loaded by getResource(). Use getResponse() instead.
at com.meterware.httpunit.ParsedHTML.getIncludedScript(ParsedHTML.java:356)
at com.meterware.httpunit.ParsedHTML.getScript(ParsedHTML.java:339)
at com.meterware.httpunit.ParsedHTML.interpretScriptElement(ParsedHTML.java:319)
at com.meterware.httpunit.ParsedHTML.access$700(ParsedHTML.java:37)
at com.meterware.httpunit.ParsedHTML$ScriptFactory.recordElement(ParsedHTML.java:489)
at com.meterware.httpunit.ParsedHTML$2.processElement(ParsedHTML.java:702)
at com.meterware.httpunit.NodeUtils$PreOrderTraversal.perform(NodeUtils.java:195)
at com.meterware.httpunit.ParsedHTML.loadElements(ParsedHTML.java:718)
at com.meterware.httpunit.ParsedHTML.getLinks(ParsedHTML.java:118)
at com.meterware.httpunit.WebResponse.getLinks(WebResponse.java:405)
at com.topcoder.zeus.ccx.ebin.constants.accuracytests.AdvancedSearchResultsJspTests.endResults(AdvancedSearchResultsJspTests.java:30)
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 org.apache.cactus.internal.client.ClientTestCaseCaller.callGenericEndMethod(ClientTestCaseCaller.java:441)
at org.apache.cactus.internal.client.ClientTestCaseCaller.callEndMethod_aroundBody2(ClientTestCaseCaller.java:208)
at org.apache.cactus.internal.client.ClientTestCaseCaller.callEndMethod_aroundBody3$advice(ClientTestCaseCaller.java:306)
at org.apache.cactus.internal.client.ClientTestCaseCaller.callEndMethod(ClientTestCaseCaller.java)
at org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTestCaseCaller.java:148)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(AbstractCactusTestCase.java:215)
at org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactusTestCase.java:133)
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 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)



I have alreay added js.jar in the classpath on serverside.
Can anyone help? Thank you.    <<Less
About | Sitemap | Contact