You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Nielsen, Jim" <ji...@eds.com> on 2003/06/20 13:01:15 UTC
Struts, Junit testing
Hi,
I'm am working through the Struts Kick Start book by Turner/Bedell and can't
get Junit testing working with the Sample app as described in Chapter 20.
I have ant 1.5, Junit 3.7, Tomcat 4.1.18, JDK 1.3.1_04.
Here is my section of the build.xml file for Junit:
<target name="struts-tests" depends="build" >
<junit printsummary="yes" >
<classpath >
<pathelement location="${object.home}"/>
<pathelement location="${build.home}"/>
<pathelement location="${build.home}/WEB-INF/classes"/>
<path refid="compile.classpath"/>
</classpath>
<formatter type="plain" />
<test name="ch20.hello.mocktest.TestHelloAction" />
<!-- <test name="ch20.hello.mocktest.TestHelloActionMultiple" />
-->
</junit>
</target>
here is my output from the test:
Testsuite: ch20.hello.mocktest.TestHelloAction
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 4.397 sec
------------- Standard Error -----------------
0 [main] INFO servletunit.ServletContextSimulator - ActionServlet: init
150 [main] INFO util.PropertyMessageResources - Initializing,
config='org.apache.struts.util.LocalStrings', returnNull=true
150 [main] INFO util.PropertyMessageResources - Initializing,
config='org.apache.struts.action.ActionResources', returnNull=true
3075 [main] INFO util.PropertyMessageResources - Initializing,
config='ch20.hello.ApplicationResources', returnNull=true
------------- ---------------- ---------------
Testcase: testNoParameters took 4.397 sec
Caused an ERROR
null
java.lang.NullPointerException
at servletunit.struts.Common.getActionConfig(Common.java:221)
at servletunit.struts.Common.findForward(Common.java:216)
at servletunit.struts.Common.verifyForwardPath(Common.java:139)
at
servletunit.struts.MockStrutsTestCase.verifyForward(MockStrutsTestCase.java:
462)
at
ch20.hello.mocktest.TestHelloAction.testNoParameters(TestHelloAction.java:14
)
Testcase: testNoParameters
My struts-config.xml file is in the {build.home}/WEB-INF directory.
Does anyone have any ideas on what the problem is or where I should look?
Thanks in advance
Jim Nielsen
EDS
jim.nielsen@eds.com
phone: (810) 234-4025 (8-394)
AOL IM: JimRNielsenEDS
GLTC-B
4100 S. Saginaw., MC: 485-303-321
Flint, MI 48557
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org