Hi,
I am new to cactus, and am trying to test servlets through it.
I follow the tutorial that comes along with the cactus download and it
works fine.
Then I try to test a servlet of my own, and I get an exception.
It is attached below.
Why am I getting this? I have no idea. Can somebody help? What can I do
to run my tests successfully.
Testsuite: TestServlet
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 1.187 sec
Testcase: testDoGet took 0.952 sec
Caused an ERROR
null
java.lang.NullPointerException
at
com.meterware.httpunit.ParsedHTML.getIncludedScript(ParsedHTML.java:305)
at com.meterware.httpunit.ParsedHTML.getScript(ParsedHTML.java:289)
at
com.meterware.httpunit.ParsedHTML.interpretScriptElement(ParsedHTML.java
:269)
at com.meterware.httpunit.ParsedHTML.access$600(ParsedHTML.java:37)
at
com.meterware.httpunit.ParsedHTML$ScriptFactory.recordElement(ParsedHTML
.java:404)
at
com.meterware.httpunit.ParsedHTML$2.processElement(ParsedHTML.java:556)
at
com.meterware.httpunit.NodeUtils$PreOrderTraversal.perform(NodeUtils.jav
a:169)
at com.meterware.httpunit.ParsedHTML.loadElements(ParsedHTML.java:566)
at com.meterware.httpunit.ParsedHTML.getLinks(ParsedHTML.java:113)
at
com.meterware.httpunit.ParsedHTML.getFirstMatchingLink(ParsedHTML.java:6
78)
at com.meterware.httpunit.ParsedHTML.getLinkWith(ParsedHTML.java:653)
at com.meterware.httpunit.WebResponse.getLinkWith(WebResponse.java:365)
at TestServlet.endDoGet(TestServlet.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.cactus.internal.client.ClientTestCaseCaller.callGenericEndMet
hod(ClientTestCaseCaller.java:441)
at
org.apache.cactus.internal.client.ClientTestCaseCaller.callEndMethod_aro
undBody2(ClientTestCaseCaller.java:208)
at
org.apache.cactus.internal.client.ClientTestCaseCaller.callEndMethod_aro
undBody3$advice(ClientTestCaseCaller.java:206)
at
org.apache.cactus.internal.client.ClientTestCaseCaller.callEndMethod(Cli
entTestCaseCaller.java)
at
org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTes
tCaseCaller.java:148)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(Abstract
CactusTestCase.java:215)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactus
TestCase.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:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe
stRunner.java:231)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT
estRunner.java:409)
-Sadaf