fun with NetBeans & StrutsTestCase
- From: "Phlip" <phlip2005@xxxxxxxxx>
- Date: 14 Sep 2005 09:24:19 -0700
Newsgroupies:
I have this boss who thinks we have to write lots of unit tests,
instead of getting anything done.
Under the NetBeans editor, and its bundled TomCat, he wants us to use
StrutsTestCase, from here:
http://strutstestcase.sourceforge.net/
That mocks the servlet layer and the GUI layer within, permitting test
cases like this:
public void testSuccessfulLogin() {
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
setRequestPathInfo("/login");
actionPerform(); // <-- trouble
verifyForward("success");
...
My boss seems to think that running these tests over and over again
will somehow "propell development", and be more efficient than manually
logging into our site and messing with it over and over again.
Whatever.
However, that test fails with this spew:
compile-test:
Sep 14, 2005 8:53:13 AM org.apache.struts.action.ActionServlet
initServlet
SEVERE: The /WEB-INF/web.xml was not found.
The sub-spew says:
Sep 14, 2005 8:53:13 AM org.apache.struts.action.ActionServlet init
SEVERE: Unable to initialize Struts ActionServlet due to an unexpected
exception or error thrown, so marking the servlet as unavailable. Most
likely, this is due to an incorrect or missing library dependency.
javax.servlet.ServletException: The /WEB-INF/web.xml was not found.
at
org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1138)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:328)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at
servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:326)
at
servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:394)
at TestLoginAction.testSuccessfulLogin(TestLoginAction.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Everyone else can find the magic /WEB-INF/web.xml file.
Note that the path starts with /. (Temporarily) putting that folder in
the root makes us stop running at actionPerform() instead of just
crash.
The documentation just says to add various permutations of...
setConfigFile("/WEB-INF/struts-config.xml");
....to the test case. None of the permutations work, and the error
message continues to speak of web.xml, not struts*.xml.
Has anyone here got this stuff working in the NetBeans editor?
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
.
- Follow-Ups:
- fun with NetBeans & StrutsTestCase
- From: Phlip
- fun with NetBeans & StrutsTestCase
- Prev by Date: Comparing class files for equivalence
- Next by Date: fun with NetBeans & StrutsTestCase
- Previous by thread: Comparing class files for equivalence
- Next by thread: fun with NetBeans & StrutsTestCase
- Index(es):