Cactus is a simple test framework for unit testing server-side java
code (Servlets, EJBs, Tag Libs, Filters, ...).
The intent of Cactus is to lower the cost of writing tests for
server-side code. It uses JUnit and
extends it.
Cactus implements an in-container strategy, meaning that tests are
executed inside the container.
The Cactus Ecosystem is made of several components:
The Cactus Framework: This is the heart of Cactus. It is the engine
that provides the API to write Cactus tests.
The Cactus Integration Modules: They are front ends and frameworks
that provide easy ways of using the Cactus Framework (Ant scripts,
Eclipse plugin, Maven plugin, ...).
The Cactus Samples: They are simple projects that demonstrate how
to write Cactus tests and how to use some of the Integration Modules.
Different kinds of unit tests
There are several kinds of unit testing frameworks. We categorize them
in 3 types:
Type 1: code logic unit testing. Probably the
best strategy for these tests is to use a
Mock Objects type
framework.
Type 2: integration unit testing. Cactus is
typically in this category (we'll let you judge if it is the best or
not :)). These tests will exercise the interactions with the
container.
Type 3: functional unit testing. These unit tests
will let you test the returned values from your server code. This is
for example
HttpUnit (Note that HttpUnit also
performs standard functional testing - as opposed to functional unit
testing -, which let you test full use cases - a login use case for
example, which is comprised of several requests/responses).
Ideally you would use 3 different frameworks just to unit test your
code ! Then you have to think about acceptance testing, system
integration testing, ...
Cactus was developed to fit Type 2 but also to be a very good
compromise for types 1 and 3, with the idea that it is much easier to
have to write tests for a single framework than for several ! Moreover,
you can never fully test your code. We believe Cactus provides a middle
ground that provides a high confidence that your code will run when
deployed. However, it is your choice and you can use Cactus only for
type 2 if you wish.