fun with NetBeans & StrutsTestCase



Phlip wrote:
> Newsgroupies:

> http://strutstestcase.sourceforge.net/

> public void testSuccessfulLogin() {
>
> addRequestParameter("username","deryl");
> addRequestParameter("password","radar");
> setRequestPathInfo("/login");
>
> actionPerform(); // <-- trouble
>
> verifyForward("success");

> SEVERE: The /WEB-INF/web.xml was not found.

This thread seems to cover that:

http://www.testdriven.com/modules/newbb/viewtopic.php?topic_id=1683&forum=6&PHPSESSID=15bdc965449e56e1840e18d5a0157c73

Sorry about the long URL (not my site!). I'l summarize:

George D: The /WEB-INF/web.xml was not found.

JBRainsberger: Create the ServletRunner, passing in the fully-qualified
pathname of
web.xml (which you can extract to a JVM property or something). That
should help.

New question: The ServletRunner from what JAR? Google only references a
'com.netscape' JAR, and I don't want to add someone else's servlet
system to this Tomcat mix.

George D: File webXml = new
File("/home/george/workspace/MyProj/WebRoot/WEB-INF/web.xml");
assertTrue(webXml.canRead());
ServletRunner sr = new ServletRunner(webXml,"");

It seems that our previous use of a relative path wasn't the problem,
it
was the lack of context for Struts.

We're still having difficulty. We register the ActionServlet ok:

sr.registerServlet("RequestInfo", ActionServlet.class.getName());

But what name do we use for the servlet that the JSP compiles to? And
should it be registered as JspServlet.class.getName()?

New question: Where is he calling those lines, and to what does he pass
the sr?

George D: Yay! We got a green bar. It turns out we don't need to
register the
JspServlet, but we *do* need to include the commons-el.jar on the
classpath. <sigh>

This leaves me searching for commons-el.jar.

Yes, I'm gonna get JBR's book, but does anyone have a code drop with
all this stuff in it?

--
Phlip

.