You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by David Sewell/MxI Technologies <da...@mxi.com> on 2007/01/17 18:23:30 UTC

HttpUnit Integration

Hello,

I am currently working on a unit test which uses the Cactus framework to 
test a JSP. The problem is that the method which is used to get the 
HTTPUnit WebResponse (WebResponse.newResponse(...)) does not use the 
WebClient in any way. This seems to be what is causing the following 
problem when running the unit test. I'm not sure what kind of solution 
would be required but I have noticed that others on this mailing list have 
had a similar problem. I think if you used "new 
com.meterware.httpunit.WebConversation().getResponse( WebRequest request 
)", it would allow scripts to be included properly.

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.getTables(ParsedHTML.java:185)
        at 
com.meterware.httpunit.ParsedHTML.getFirstMatchingTable(ParsedHTML.java:914)
        at 
com.meterware.httpunit.ParsedHTML.getTableWithID(ParsedHTML.java:963)
        at 
com.meterware.httpunit.WebResponse.getTableWithID(WebResponse.java:622)
        ...
        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:585)
        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 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


Cheers,
David Sewell

__________________________________________________________________________________
* This message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose the message or any information contained in the message. If you have received this message in error, please advise the sender by reply e-mail , and delete the message, or call (collect) 001 613 747 4698. *