<?xml version="1.0"?>
<document>

  <properties>
    <title>Using the Maven Cactus plugin</title>
    <author email="vmassol@apache.org">Vincent Massol</author>
  </properties>

  <body>
    <section name="Using the Cactus plugin">
      <ol>
        <li>
          Create a <code>src/test-cactus</code> 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 <code>cactus.src.dir</code> property.
        </li>
        <li>
          Create a <code>build.properties</code> file in your project root
          directory (where <code>project.xml</code> 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:
        </li>
<source><![CDATA[
cactus.home.tomcat4x = C:/Apps/jakarta-tomcat-4.1.24
cactus.home.resin2x = C:/Apps/resin-2.1.6
]]></source>
      </ol>
      <subsection name="Running tests packaged in a WAR">
        <p>
          If you're testing Servlets, Filters, JSPs or Taglibs, simply type
          <code>maven cactus:test</code> (or <code>maven cactus</code> for 
          short) to run the Cactus tests.
        </p>
      </subsection>
      <subsection name="Running tests packaged in an EAR">
        <p>
          Make sure you have created a <code>src/webapp/WEB-INF/web.xml</code>
          file. You can put inside the <code>&lt;ejb-ref&gt;</code> entries 
          required to call your EJBs from your Cactus test case classes.
        </p>
        <p>
          To start your EJB unit tests, simply type 
          <code>maven cactus:test-ear</code>.
        </p>
      </subsection>
      <subsection name="Custom test jars">
        <p>
          Some jars are used only for testing (for example, DbUnit). These
          jars can be entered as dependencies in the <code>project.xml</code>
          and tagged with <code>cactus.bundle</code>. When the Cactus plugin 
          finds such jars it will automatically add them to the deployed war. 
          For example:          
        </p>
<source><![CDATA[
    <dependency>
      <groupId>dbunit</groupId>>
      <artifactId>dbunit</artifactId>>
      <version>1.5.5</version>
      <properties>
        <cactus.bundle>true</cactus.bundle>
      </properties>
    </dependency>
]]></source>
      </subsection>
    </section>

 </body>
</document>
