Hi Cactusers !
If you're working with Tomcat 4.x, here is the best way that I have
found to integrate Cactus. It is non-intrusive at all for your webapp !
<tomcat install dir>
|_ conf
|_ web.xml (add Cactus redirector and mapping as usual)
|_ common
|_ lib
|_ cactus.jar
|_ aspectjrt.jar
|_ junit.jar
|_ webapps
|_ mywebapp
|_ WEB-INF
|_ web.xml (nothing related to Cactus)
|_ lib
|_ (no cactus jar)
|_ classes
|_ classes under test
|_ cactus test classes
What this mean is that :
1/ Your WAR contain minimal Cactus intrusion (only the test classes)
2/ You can "reuse" the Cactus jars and the Cactus redirector mapping for
all webapps
What would be real nice now would be that Tomcat bundles the 3 Cactus
jars and the mapping for redirectors in conf/web.xml, and declare that
the "recommended" way to unit test servlets,jsps,taglibs,filters is
Cactus, linking to some Cactus Tomcat Howto tutorial on the Cactus web
page.
As a Tomcat user, if you wish to write a unit test for your servlet, you
would only have to include your test class in your webapp and off you go
!
I have just realized that it may be nice to include a
CactusServletTestRunner (which would be a servlet) as part of the cactus
jar (in the same way it is done in JunitEE - Hey Kaarle, I now
understand you ! :-)) so that if you wanted to quickly exercise your
test you could call that servlet as in :
http://server:port/mywebapp/CactusServletTestRunner?suite=name_of_test_c
lass
That would execute the Cactus tests (including beginXXX and endXXX in
the Server JVM) and display the result as HTML or XML (Note: I actually
prefer XML and drop an XSL stylesheet to automatically transform it in
HTML if need be).
Cactus would thus provide 2 solutions to kick start its tests :
- the normal way, i.e. through any existing JUnit Test Runner and thus
through any existing JUnit tool, including IDE JUnit integration plugins
- through the CactusServletTestRunner
Once this is done, I think we have a winner (can't be easier for someone
wanting to write servlet API unit tests !) and can start lobbying the
Tomcat team to bundle Cactus in their distribution.
What do you think ?
Thanks
-Vincent
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>