-
Can you check to see if getActionServlet(); is returning null?
e.g. In your test case before calling actionPerform(); call assertNotNull(getActionServlet());
Is your Action class in your classpath when running the test?
Perhaps if I could see your struts-config.xml and testCase (along with anything in the setUp method) I would have better insight.
2009-11-11 17:30:04 UTC by crack_phantom
-
Hi,
If i change it to setServletConfigFile("WEB-INF/web2.xml");
i got this error:
------
junit.framework.AssertionFailedError: Invalid pathname: WEB-INF/web2.xml
at servletunit.struts.MockStrutsTestCase.setServletConfigFile(MockStrutsTestCase.java:602)
----
So i think the path with "WEB-INF/web.xml" is valid.
If i remove setServletConfigFile("WEB-INF/web.xml");
I got the...
2009-11-11 10:24:07 UTC by schatzb
-
You shouldn't have to use setServletConfigFile("WEB-INF/web.xml");
So try removing it.
setContextDirectory should find the web.xml on it's own e.g. it takes the Dir specified by setContextDirectory and looks for web.xml at WEB-INF/web.xml
So is /home/user/workspace/APP/WEB-INF/web.xml a valid location?.
2009-11-10 15:52:25 UTC by crack_phantom
-
I got a NullPointerException whenever i execute actionPerform()
****
servletunit.struts.ExceptionDuringTestError: A NullPointerException was thrown.
This may indicate an error in your ActionForm, or it may indicate that the Struts ActionServlet was unable to find struts config file.
TestCase is running from /home/user/workspace/APP directory.
Context directory is...
2009-11-10 15:14:33 UTC by schatzb
-
Hi I am using MockStrutsTestCase for my junit testing. When i use setActionForm to set the form ,in action i get form as a new form and get all values null.
But instead if i use addrequestparameter and send, it is fine. Please help me .....
2009-08-07 05:30:59 UTC by jitzash