plug-in for Cactus is a runner for server-side unit tests. It is
intended to hide the complexity of setting up an environment for
running Cactus tests. It supports a variety of commercial and
open-source application servers (better called containers).
Adds a shortcut for Cactus tests launching.
Relies on the Eclipse Ant integration to :
deploy the application
start the container before running the tests
stop the container when tests have ended
Integrated Jetty container support
Cactus preference page
Port on which the container is started.
Working directory where the Cactus plugin will create temporary
files (packaged war, container configuration files, etc).
Support for several containers
The user can provide its own web.xml file. If this is not the case
the plug-in will use the one by default.
Relies on the JUnit plug-in for test runs and result reports.
Cactify a Java project : adds client-side jars to a project's
From version 1.8 there is a quickfix feature you can use.
The Cactus plugin requires a version of the Eclipse platform later
Uncompress the zip file and copy the
to your Eclipse
plugins folder and restart Eclipse.
Go to Window -> Preferences -> Cactus and set your preferences.
Select any Cactus test class and from the toolbar do :
Run As -> Cactus Test
In order to release a production-quality tool some features are needed.
See the todo section on the Cactus framework page for a list of
Overview of the plug-in
The Cactus framework extends JUnit. The Cactus
plugin for Eclipse extends in a certain manner the existing JUnit
plugin. For example
is overloaded to be able to:
prepare tests: set up the container (deployment) and start it
- execute tests using the JUnit plugin
tear down tests: stop the container and clean the deployment.
The plugin uses Ant scripts from the Ant integration subproject for
How it works
registers a shortcut which appears in the run and debug
cascade menus to launch the current workbench selection in the
adds the Cactus preference page to the preferences.
GUI: preference page
A preference page is contributed to the Eclipse preferences. It
shows the following entries:
- Cactus properties (contextURL)
directory of all the jars needed for Cactus tests (client
side and server side)
- setting of the container homes
To enable different ways to setup, start, and stop containers the
idea of container providers has been introduced in the plugin.
A container provider is responsible for deploying a web application
to the container, starting and stopping it, and undeploying the web
app. This concept is concretized in the interface
. See its javadoc for more information.
A container manager is implemented in the current version of the
plugin, which uses Ant scripts to carry out these actions. It is
and may be used to execute tests on all the containers supported
by the Ant integration subproject.
What happens when a test is launched
launch(IType theType, String theMode)
method of the
class is called, which sets up the container, launches the
tests by delegating these to the JUnit plugin, and then tears down
the container setup.
In the case of
creating the war file for the cactus tests: this is
done in a call to the
setting up the container: prepares the configuration
for the selected container
starting the container.
setting up is done by an Ant script
starting the container is delegated to the
class, which initiates a thread starting the container
and then pings it constantly to see if it has effectively
This behaviour is inherited from the JUnit plugin since
To know when tests have ended we register our TestListener to
the JUnit plugin. To this end the JUnit plugin needed a
modification which has been integrated in the 2.1 release of
the Eclipse platform.
Test environment cleaning
After the tests have completed we stop the container, and
delete the configuration and war files created beforehand.