2011/08/05 - Jakarta Cactus has been retired.

For more information, please explore the Attic.

Using the Cactus plugin

  1. Create a src/test-cactus directory in your project and put your Cactus test classes in it (with the normal package directory structure). Note that the location of the Cactus test sources can be configured through the cactus.src.dir property.
  2. Create a build.properties file in your project root directory (where project.xml is located) and define in it the location of the container you wish to use for the tests. For example, if you wish to run the Cactus tests on Tomcat 4.1.24 and on Resin 2.6, you will write:
  3. cactus.home.tomcat4x = C:/Apps/jakarta-tomcat-4.1.24
    cactus.home.resin2x = C:/Apps/resin-2.1.6

Running tests packaged in a WAR

If you're testing Servlets, Filters, JSPs or Taglibs, simply type maven cactus:test (or maven cactus for short) to run the Cactus tests.

Running tests packaged in an EAR

Make sure you have created a src/webapp/WEB-INF/web.xml file. You can put inside the <ejb-ref> entries required to call your EJBs from your Cactus test case classes.

To start your EJB unit tests, simply type maven cactus:test-ear.

Custom test jars

Some jars are used only for testing (for example, DbUnit). These jars can be entered as dependencies in the project.xml and tagged with cactus.bundle. When the Cactus plugin finds such jars it will automatically add them to the deployed war. For example: