Java Reference
In-Depth Information
way to trigger the execution of the tests when the archive is deployed. We also
need a way to prepare the archive for deployment. This is all part of the tight inte-
gration between Cactus and the various build systems. We deal with this integra-
tion in subsequent chapters.
14.7
Executing Cactus tests with Ant
The first way to fire up Cactus tests that we're going to show seems to be the most
common one. Using Ant is easy and straightforward. If you're new to Ant, we'd like
to recommend to you Ant in Action , by Steve Loughran and Erik Hatcher—a mar-
velous book. Also, before you read this section, please make sure you've already
read chapter 8.
14.7.1
Cactus tasks to prepare the archive
Cactus comes bundled with two kinds of Ant tasks: the first one will facilitate you in
preparing the archive ( WAR or EAR ) to hold the test cases, and the second will
invoke the tests. We go through these tasks one after the other and show you how
to use them.
The process of preparing the archive for executing the tests is called cactification .
This term was introduced by the Cactus team. Imagine you have at some point an
archive (a WAR or EAR file), which is the application that you want to deploy. The cac-
tification process includes adding the required JAR s into the lib folder of the archive
and also patching the web.xml to include desired Cactus redirectors.
According to the type of archive that you want to cactify, there are two different
tasks that you may want to use: cactifywar and cactifyear . Before we rush into
describing these tasks, let's first take a minute to focus on the build.xml skeleton that
we use for our presentation purposes (see listing 14.13).
Listing 14.13
Build.xml skeleton to execute the Cactus tests
<project name="Cactus sample tests" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="init" depends="">
[...]
<property name="target.dir" location="${basedir}/target"/>
<property name="classes.dir" location="${target.dir}/classes"/>
[...]
B
C
<ivy:configure file="ivysettings.xml" />
<ivy:retrieve file="ivy.xml" sync="true"/>
<path id="compile.cp">
<fileset dir="${lib.dir}">
<include name="*.*"/>
</fileset>
</path>
</target>
D
 
 
 
 
 
 
Search WWH ::




Custom Search