Configuring Cactus
Problem
You want to set up Cactus to test Servlets, JSPs, and Filters.
Solution
Add junit.jar
, cactus.jar
,
httpclient.jar
,
commons-logging.jar
,
log4j.jar
, and aspectjrt.jar
to the
client classpath. Add junit.jar
,
cactus.jar
,
commons-logging.jar
, and
log4j.jar
to your web
application’s WEB-INF/lib
directory.
Discussion
A Cactus test suite executes on both client and server, requiring both client and server classpaths to be set properly. Cactus configuration is tricky and almost all Cactus problems are related to classpath issues. This chapter assumes Cactus 1.4.1, which bundles the JAR files listed below.
Tip
The JAR files that come bundled with Cactus 1.4 and higher include
the version of the tool in the filename. For example, the JUnit JAR
file used in Cactus 1.4.1 is junit-3.7.jar
,
specifying JUnit 3.7 is being used. This chapter does not assume any
specific version for JAR files because you are free to use any
compatible version of a third party tool.
Client-side classpath
junit.jar
contains
the JUnit framework that Cactus
extends from, and is needed to compile and run the Cactus test suite.
All Cactus framework test cases, as mentioned in the introduction,
extend the org.junit.framework.TestCase
class.
cactus.jar
contains the
Cactus framework, which includes three
Cactus test cases (ServletTestCase
,
JspTestCase
, FilterTestCase
)
that your test classes may extend.
httpclient.jar
contains a framework supporting HTTP-based methods such as GET and POST, provides the ...
Get Java Extreme Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.