Starting Cactus tests

The Cactus tests are started using a JUnit Test Runner. There are several integration clients you can use for executing these test runners:

  • Manually. This means that you need to deploy your code and tests into your container and start this container by yourself. Then you can execute the tests by running a standard JUnit test Runner. For example, you can start the tests:
    • From the java command line, calling the main() method of a JUnit Test Runner. For example, running the JUnit Swing Test Runner: junit.swingui.TestRunner.main [test case class]
    • From an IDE or any tool providing a JUnit integration plugin.
    • From a browser, by using the Cactus Servlet Test Runner, which is a special JUnit Test Runner. Please also check the Tomcat quick start tutorial which is a step by step tutorial describing how to deploy Cactus tests in Tomcat and how to execute them through a browser.
    • From Ant by simply using the <junit> Ant task found in the Ant distribution.
  • Using the Cactus Ant integration. Cactus provides several custom Ant task to automate the deployment of Cactus tests (<cactifywar>) and the start/stop/configuration of your container (<cactus>). Note that you can also use the custom <runservertests> Ant task which allows you to use your existing container configuration should you wish to.
  • Using the Cactus Maven plugin. As with the Ant tasks this plugin offers a fully automated solution to deploy and execute Cactus tests.
  • Using the Jetty integration. Cactus provides a JettyTestSetup class that you can directly use in your Cactus TestCase's suite() method. This TestSetup class will automatically configure and start Jetty for you before the tests are executed and it will stop it once the tests are finished. The nice thing is that starting Jetty takes only a few hundreds of milliseconds making this solution the fastest one to execute your Cactus tests. Obviously it is only interesting if you wish to test using Jetty.