First of all, you need to download the Cactus distribution
Let's assume the following conventions:
{Cactus dir} is the directory where you
have unzipped the Cactus distribution or sources.
Let's also assume {Tomcat dir} to be the Tomcat directory.
Create a JUnit library and include junit.jar.
Create a Cactus library containing cactus.jar and
aspectjrt.jar (you can actually create a separate
library for AspectJ if you wish).
Create another library named tomcat
and add all the jar files from {Tomcat dir}/lib.
Edit a new file named cactus.properties
(see the Configuration Howto
tutorial for more details on cactus.properties).
Copy your cactus.properties file to a directory present
in your classpath. You can copy it to a directory and add this
directory in the class tab of the cactus library.
Create and edit the file
{Tomcat dir}/webapps/cactus/WEB-INF/web.xml. Here is an
example for Servlet API 2.2:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>ServletRedirector</servlet-name>
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletRedirector</servlet-name>
<url-pattern>/ServletRedirector</url-pattern>
</servlet-mapping>
</web-app>
{Tomcat dir}/conf/web.xml instead if you
prefer. web.xml file of the webapp where is
located the servlet(s) you want to test. cactus.properties file accordingly.
-classic -Dtomcat.home="{Tomcat dir}" as the VM
parameters for your project and
org.apache.tomcat.startup.Tomcat as the main class.
Required Libraries
tab in the project properties:
Run/Run Project menu.
run
Run/debug
project). This way, you can stop at breakpoints on methods
that are executed on the server side (void testXXX() for
example)
If you right click on the file containing your test case and click
on debug, you can stop at breakpoints on methods that
are executed on the client side like
void endXXX(WebResponse) or
void beginXXX(WebRequest)