Cactus In-Container Integration Testing

Public Targets

TargetDescription
itest.distpackage target and test distribution files
itestrun Cactus unit test(s) manually

Source: ejbtest-cactus.xml

				<?xml version="1.0" encoding="UTF-8"?>
<project name="cactus">
	<description>
  + ==\_/============J=A=V=A=G=E=N===A=N=T===M=O=D=U=L=E=S================= +
  +  \(_)/                                                                  +
  +  -(_)-          Cactus In-Container Integration Testing                 +
  +  /(_)\                                                                  +
  + ======================================================================= +
  +    Copyright (c) 2002-2005 Outsource Cafe, Inc.  All rights reserved.   +
  + ======================================================================= +
  +
  + Supports in-container unit testing using Cactus. Cactus is used for testing
  + code that can only be accessed within the J2EE application server or that
  + depends on container-provided services, such as local EJBs.
  +
  + By default all tests found in the 'test-cactus' directories ending with the 
  + 'ITest' suffix are executed.  Overriding the 'itest.batchtest.pattern' allows
  + you to change the default settings.  Single tests can be run by assigning 
  + the full classname to the 'itestcase' property.   
  +
  + You can use testcycle.xml to automate the deploy-test-undeploy process.
  +
  + If you are testing remote EJBs, can test remotely using the itest.xml module.
  + You can combine standard unit testing in the same build by importing utest.xml.
  +
  + Public Targets: 
  +   itest      - runs cactus unit test(s), generating reports
  +   itest.dist - package target and test distribution files
  +
  + Optional properties:
  +   itestcase          - when set allows single unit test to be run instead of batchtest
  +   itest.updotate.on  - if set: skip running tests again if tests are uptodate
  +   testreports        - when set test results generate reports
  +   target.classes.dir - classes to test, defaults to build.classes.dir
  +   target.dist.name   - distro to test, defaults to ${module.name}-${module.version}.jar
  +   test.dist.name     - distro to deploy, defaults to ${module.name}-test-${module.version}.ear
  +
  + Prerequisite imports: 
  +   props-global.xml, classpath.xml, appserver-X.xml, ejb.xml
  +
  + Note: the 'itest' prefix is to avoid name conflicts with other JAM modules.
  +
  + TODO: Refactor, if necessary, to allow testing of webapp components.
  +
  + BUILD BREAKERS - UPGRADING FROM JAM 2.0 TO 2.1:
  +  - testcycle target removed, you must now import the testcycle.xml module
  +  - test-cactus was replaces by itest as the default integration test folder,
  +    you must set itest.folder=test-cactus prior to importing props-global.xml
  +    to restore this configuration.
  +  - itest.class.include renamed itest.batchtest.include
  +
  + developer: RichardEasterling@OutsourceCafe.com
  + ======================================================================= +
  + Licensed under the Apache License, Version 2.0 (the "License");
  + you may not use this file except in compliance with the License.
  + You may obtain a copy of the License at
  +
  +   http://www.apache.org/licenses/LICENSE-2.0
  +
  + Unless required by applicable law or agreed to in writing, software
  + distributed under the License is distributed on an "AS IS" BASIS,
  + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + See the License for the specific language governing permissions and
  + limitations under the License.
  + =J=A=M===========================================J=A=V=A=G=E=N=.=C=O=M= +
	</description>
	<property name="CACTUS.PRESENT" value="true"></property>
	<property name="ITEST.PRESENT" value="true"></property>
	<!-- =================================================================== -->
	<!-- Public targets - override as needed: -->
	<!-- =================================================================== -->
	<target name="itest.dist" description="package target and test distribution files" depends="itest.check, itest.gen, itest.compile, itest.resources, itest.war, cactify, itest.appxml, itest.ear"></target>
	<target name="itest" description="run Cactus unit test(s) manually" depends="itest.run, itest.fail"></target>
	<!-- 'testcycle' MOVED TO testcycle.xml
	<target name="testcycle" depends="servertest" description="run integration tests, starts/stops server as needed"/>
	-->
	<target name="testdist" depends="itest.dist">
		<echo>DEPRICATED, use 'itest.dist' instead</echo>
	</target>
	<!-- =================================================================== -->
	<!-- Exported support targets -->
	<!-- =================================================================== -->
	<!-- 'testcycle' uses 'itest.run' to delay failure until server shutdown -->
	<target name="itest.run" depends="itest.uptodate, itest.console, itest.report"></target>
	<!-- ===================================================================== -->
	<!-- local properties -->
	<!-- ===================================================================== -->
	<property name="testtool.name" value="Cactus"></property>
	<property name="target.module.folder" location="${basedir}"></property>
	<property name="target.dist.dir" location="${target.module.folder}/${dist.folder}"></property>
	<property name="target.dist.name" value="${module.name}-${module.version}.jar"></property>
	<property name="target.dist.file" location="${target.dist.dir}/${target.dist.name}"></property>
	<property name="test.dist.name" value="${module.name}${dist.test.suffix}-${module.version}.ear"></property>
	<property name="test.dist.file" location="${dist.dir}/${test.dist.name}"></property>
	<!-- seems we have to hard code this to 'cactus.war'
	<property name="test.dist.war.name" value="${module.name}${dist.test.suffix}-${module.version}.war"/>
	-->
	<property name="test.dist.war.name" value="cactus.war"></property>
	<property name="test.dist.war.file" location="${dist.dir}/${test.dist.war.name}"></property>
	<property name="itest.last.failed.file" location="${build.dir}/.lasttestsfailed"></property>
	<property name="target.classes.dir" location="${build.classes.dir}"></property>
	<!-- optional properties set in build file:
   <property name="utestcase" value="AllITests"/>
	<property name="testreports" value="true"/>
	-->
	<!-- ===================================================================== -->
	<!-- adds cactus.war and {module}-{version}-ejb.jar to application.xml -->
	<!-- ===================================================================== -->
	<property name="target.modules" value="&lt;module&gt;&lt;ejb&gt;${module.name}-${module.version}.jar&lt;/ejb&gt;&lt;/module&gt;&lt;module&gt;&lt;web&gt;&lt;web-uri&gt;cactus.war&lt;/web-uri&gt;&lt;context-root&gt;test&lt;/context-root&gt;&lt;/web&gt;&lt;/module&gt;"></property>
	<filterset id="appxml.module.filter">
		<filter token="TARGET-MODULE" value="${target.modules}"></filter>
	</filterset>
	<!-- ===================================================================== -->
	<!-- security properties -->
	<!-- ===================================================================== -->
	<property name="cactus.authorization.roles" value=""></property>
	<property name="cactus.securitydomain" value=""></property>
	<!-- ===================================================================== -->
	<!-- patternset to identify integration tests to execute -->
	<!-- ===================================================================== -->
	<property name="itest.uptodate.pattern" value="*ITest"></property>
	<property name="itest.batchtest.include" value="**/*ITest.java"></property>
	<patternset id="itest.batchtest.patternset">
		<include name="${itest.batchtest.include}"></include>
		<exclude name="${utest.batchtest.exclude}"></exclude>
	</patternset>
	<!-- ===================================================================== -->
	<!-- jars defaults - can override in POM/classpath.xml -->
	<!-- ===================================================================== 
	Upgraded following dependencies: Commons BeanUtils to 1.7.0, Commons Collections to 3.1, 
	Commons HttpClient to 2.0.2 and Commons Logging to 1.0.4. (VMA)
	<property name="cactus-ant-13.jar" location="${maven.repo}/cactus/jars/cactus-ant-13-1.6.1.jar"/>
	<property name="cactus-13.jar" location="${maven.repo}/cactus/jars/cactus-13-1.6.1.jar"/>
	<property name="aspectjrt.jar" location="${maven.repo}/aspectj/jars/aspectjrt-1.1.1.jar"/>
	<property name="commons-httpclient.jar" location="${maven.repo}/commons-httpclient/jars/commons-httpclient-2.0.jar"/>
	<property name="commons-logging.jar" location="${maven.repo}/commons-logging/jars/commons-logging-1.0.4.jar"/>
	-->
	<property name="servletapi.jar" location="${maven.repo}/servletapi/jars/servletapi-2.3.jar"></property>
	<property name="cactus-ant-13.jar" location="${maven.repo}/cactus/jars/cactus-ant-13-1.7.jar"></property>
	<property name="cactus-13.jar" location="${maven.repo}/cactus/jars/cactus-13-1.7.jar"></property>
	<property name="aspectjrt.jar" location="${maven.repo}/aspectj/jars/aspectjrt-1.2.1.jar"></property>
	<property name="commons-httpclient.jar" location="${maven.repo}/commons-httpclient/jars/commons-httpclient-2.0.2.jar"></property>
	<property name="commons-logging.jar" location="${maven.repo}/commons-logging/jars/commons-logging-1.0.4.jar"></property>
	<property name="junit.jar" location="${maven.repo}/junit/jars/junit-3.8.1.jar"></property>
	<echo>CACTUS junit.jar = ${junit.jar}</echo>
	<!-- ===================================================================== -->
	<!-- classpaths -->
	<!-- ===================================================================== -->
	<path id="cactus.build.classpath">
		<path refid="build.classpath"></path>
		<pathelement location="${target.dist.file}"></pathelement>
		<pathelement location="${junit.jar}"></pathelement>
		<pathelement location="${servletapi.jar}"></pathelement>
		<pathelement location="${cactus-13.jar}"></pathelement>
		<pathelement location="${cactus-ant-13.jar}"></pathelement>
		<pathelement location="${commons-logging.jar}"></pathelement>
		<pathelement location="${commons-httpclient.jar}"></pathelement>
		<pathelement location="${aspectjrt.jar}"></pathelement>
		<pathelement location="${build.itest.war.classes.dir}"></pathelement>
	</path>
	<!-- Cactus.properties and log_client.properties need to be in the classpath -->
	<path id="cactus.run.classpath">
		<path refid="cactus.build.classpath"></path>
		<path refid="appserver.client.classpath"></path>
	</path>
	<!-- ===================================================================== -->
	<!-- taskdefs -->
	<!-- ===================================================================== -->
	<taskdef resource="cactus.tasks">
		<classpath refid="cactus.build.classpath"></classpath>
	</taskdef>
	<taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="xdoclet.classpath"></taskdef>
	<!-- ===================================================================== -->
	<!-- sanity checks -->
	<!-- ===================================================================== -->
	<fail unless="APPSERVER.PRESENT" message="appserver-X.xml (where X = jboss, weblogic, etc) must be imported before ejbtest-cactus.xml in build file."></fail>
	<!-- allow use with non-ejb targets such as Hibernate
	<fail unless="EJB.PRESENT" message="ejb.xml must be imported before ejbtest-cactus.xml in build file."/>
	-->
	<condition property="cactus.folder.fail">
		<and>
			<equals arg1="${itest.folder}" arg2="itest"></equals>
			<or>
				<available file="${src.dir}/${cactus.test.folder}"></available>
				<available file="${gen.dir}/${cactus.test.folder}"></available>
			</or>
		</and>
	</condition>
	<fail if="cactus.folder.fail" message="test-cactus was replaced by &apos;itest&apos; as the default integration test folder, you must set itest.folder=test-cactus prior to importing props-global.xml to restore this configuration or rename this folder to &apos;itest&apos;."></fail>
	<condition property="cactus.properties.ok">
		<and>
			<!-- requires jdk1.3+ 
			-->
			<available file="${servletapi.jar}"></available>
			<available classname="java.lang.StrictMath"></available>
			<available file="${cactus-13.jar}"></available>
			<available file="${cactus-ant-13.jar}"></available>
			<available file="${aspectjrt.jar}"></available>
			<available file="${commons-logging.jar}"></available>
			<available file="${commons-httpclient.jar}"></available>
			<available file="${junit.jar}"></available>
		</and>
	</condition>
	<fail message="Cactus properties not set (check jars, etc.)" unless="cactus.properties.ok"></fail>
	<!-- ===================================================================== -->
	<!-- setup -->
	<!-- ===================================================================== -->
	<target name="itest.setup" depends="">
		<echo>
test.dist.name       = ${test.dist.name}
test.dist.war.name   = ${test.dist.war.name}
itestcase            = ${itestcase}
testreports          = ${testreports}
itest.batchtest.include  = ${itest.batchtest.include}
+ ============================================================= +
    </echo>
	</target>
	<!-- ===================================================================== -->
	<!-- list build classpath -->
	<!-- ===================================================================== -->
	<target name="itest.cp" depends="">
		<pathconvert refid="cactus.build.classpath" property="test.classpath.list" pathsep="${CR}"></pathconvert>
		<echo message="+ cactus.build.classpath================================= +"></echo>
		<echo message="${test.classpath.list}"></echo>
	</target>
	<!-- ===================================================================== -->
	<!-- list run classpath -->
	<!-- ===================================================================== -->
	<target name="itest.run.cp">
		<pathconvert refid="cactus.run.classpath" property="run.classpath.list" pathsep="${CR}"></pathconvert>
		<echo message="+ cactus.run.classpath================================= +"></echo>
		<echo message="${run.classpath.list}"></echo>
	</target>
	<!-- =================================================================== -->
	<!-- creates dirs, checks Cactus Tests are uptodate -->
	<!-- =================================================================== -->
	<target name="itest.check">
		<mkdir dir="${src.itest.dir}"></mkdir>
		<mkdir dir="${gen.itest.dir}"></mkdir>
		<mkdir dir="${build.itest.war.classes.dir}"></mkdir>
		<mkdir dir="${build.itest.metainf.dir}"></mkdir>
		<mkdir dir="${xdoclet.merge.dir}"></mkdir>
		<uptodate property="cactus.src.uptodate" targetfile="${build.itest.webinf.dir}/web.xml">
			<srcfiles dir="${src.itest.dir}"></srcfiles>
			<srcfiles dir="${gen.itest.dir}"></srcfiles>
		</uptodate>
		<echo>cactus.src.uptodate = ${cactus.src.uptodate} on ${build.itest.webinf.dir}/web.xml</echo>
		<available property="target.dist.file.found" file="${target.dist.file}" type="file"></available>
		<fail message="Cactus test could not find target distribution file: ${target.dist.file}" unless="target.dist.file.found"></fail>
	</target>
	<!-- =================================================================== -->
	<!-- create web.xml (and others) using XDoclet -->
	<!-- =================================================================== -->
	<target name="itest.gen" unless="cactus.src.uptodate">
		<webdoclet destdir="${build.itest.webinf.dir}" mergeDir="${xdoclet.merge.dir}">
			<fileset dir="${src.itest.dir}" includes="**/*.java"></fileset>
			<fileset dir="${gen.itest.dir}" includes="**/*.java"></fileset>
			<deploymentdescriptor servletspec="${servlet.spec.version}" distributable="false"></deploymentdescriptor>
			<jbosswebxml securitydomain="${cactus.securitydomain}"></jbosswebxml>
			<!-- throwing a NullPointerException: 
      	<resin-web-xml servletspec="${servlet.spec.version}"/>
      	-->
		</webdoclet>
	</target>
	<!-- =================================================================== -->
	<!-- compiles the test source code                                            -->
	<!-- =================================================================== -->
	<target name="itest.compile" unless="cactus.src.uptodate">
		<javac destdir="${build.itest.war.classes.dir}" source="${compiler.source}" target="${compiler.target}" classpathref="cactus.build.classpath" debug="${compiler.debug}" deprecation="${compiler.deprecation}" optimize="${compiler.optimize}" compiler="${compiler.type}" excludes="${compiler.excludes}">
			<src path="${src.itest.dir}"></src>
			<src path="${gen.itest.dir}"></src>
		</javac>
	</target>
	<!-- =================================================================== -->
	<!-- copies test resources to target/${itest.folder}/classes             -->
	<!-- =================================================================== -->
	<!-- Note: Unfortunately, the POM does not define resources for integration 
	tests, thus this (probably inadequate) default target.   If you use the same
	resources for both unit and integration testing then just override this target
	to invoke the generated utest.resources target like so:
	<target name="itest.resources">
		<antcall target="utest.resources">
			<param name="build.test.classes.dir" value="${build.itest.war.classes.dir}"/>
		</antcall>
	</target>
	-->
	<target name="itest.resources" unless="cactus.src.uptodate">
		<copy todir="${build.itest.war.classes.dir}">
			<fileset dir="${src.itest.dir}" excludes="**/*.java"></fileset>
			<fileset dir="${gen.itest.dir}" excludes="**/*.java"></fileset>
		</copy>
		<!-- Copy cactus.properties to replace the token filters -->
		<copy todir="${build.itest.war.classes.dir}" file="${jam.home}/misc/cactus.properties" filtering="on" overwrite="true">
			<filterset>
				<filter token="test.port" value="${appserver.http.port}"></filter>
				<filter token="test.host" value="${appserver.host}"></filter>
			</filterset>
		</copy>
		<!-- Copy log_client.properties so that it is in the classpath -->
		<copy tofile="${build.itest.war.classes.dir}/log4j.properties" file="${jam.home}/misc/cactus-client-log4j.properties"></copy>
	</target>
	<!-- =================================================================== -->
	<!-- package Cactus war file -->
	<!-- =================================================================== -->
	<target name="itest.war">
		<delete file="${test.dist.war.file}" failonerror="false"></delete>
		<mkdir dir="${dist.dir}"></mkdir>
		<mkdir dir="${build.itest.war.classes.dir}"></mkdir>
		<jar jarfile="${test.dist.war.file}">
			<fileset dir="${build.itest.dir}" includes="**" excludes="META-INF/**,WEB-INF/log4j.properties,WEB-INF/cactus.properties"></fileset>
		</jar>
	</target>
	<!-- =================================================================== -->
	<!-- Cactify war file -->
	<!-- =================================================================== -->
	<target name="cactify">
		<cactifywar version="${servlet.spec.version}" destfile="${test.dist.war.file}" mergewebxml="${build.itest.webinf.dir}/web.xml">
			<classes dir="${build.itest.war.classes.dir}"></classes>
			<fileset dir="${build.itest.dir}" includes="WEB-INF/*" excludes="WEB-INF/web.xml"></fileset>
			<servletredirector></servletredirector>
			<servletredirector name="ServletRedirectorSecure" mapping="/ServletRedirectorSecure" roles="${cactus.authorization.roles}"></servletredirector>
		</cactifywar>
	</target>
	<!-- =================================================================== -->
	<!-- find the application.xml or die, 'src' instance takes priority -->
	<!-- replaces @TARGET-MODULE@ filter with ejb.jar and cactus.war -->
	<!-- =================================================================== -->
	<target name="itest.appxml">
		<copy file="${gen.metainf.dir}/application.xml" todir="${build.itest.metainf.dir}" failonerror="false" overwrite="true">
			<filterset refid="appxml.module.filter"></filterset>
		</copy>
		<copy file="${src.metainf.dir}/application.xml" todir="${build.itest.metainf.dir}" failonerror="false" overwrite="true">
			<filterset refid="appxml.module.filter"></filterset>
		</copy>
		<available property="cactus.appxml.found" file="${build.itest.metainf.dir}/application.xml"></available>
		<fail unless="cactus.appxml.found" message="ERROR: application.xml NOT FOUND in ${src.metainf.dir} or ${gen.metainf.dir}, run: maven jam:appxml-filter"></fail>
	</target>
	<!-- =================================================================== -->
	<!-- package target distro, cactus.war and dependency files into ear -->
	<!-- =================================================================== -->
	<target name="itest.ear">
		<delete file="${test.dist.file}"></delete>
		<mkdir dir="${dist.dir}/${temp.folder}"></mkdir>
		<copy todir="${dist.dir}/${temp.folder}">
			<fileset refid="ear.lib.fileset"></fileset>
			<mapper type="flatten"></mapper>
		</copy>
		<ear destfile="${test.dist.file}" appxml="${build.itest.metainf.dir}/application.xml">
			<fileset dir="${dist.dir}" includes="*.war,*.jar,*.sar"></fileset>
			<fileset dir="${dist.dir}/${temp.folder}"></fileset>
			<fileset dir="${basedir}" includes="${lib.folder}/*.jar"></fileset>
		</ear>
		<delete dir="${dist.dir}/${temp.folder}" failonerror="false"></delete>
	</target>
	<!-- =================================================================== -->
	<!-- Pre-test tasks, report or console output decision and               -->
	<!-- logic to skip running unit tests if src and test(s) are uptodate.   -->
	<!-- Note: Many users can't figure out why their tests are not running   -->
	<!-- when uptodate is set.  To avoid confusion the tests run on every    -->
	<!-- call unless you explicitly set 'itest.uptodate.on' to 'true'.       -->
	<!-- =================================================================== -->
	<target name="itest.uptodate">
		<fail unless="APPSERVER.PRESENT" message="No app server imported into build"></fail>
		<condition property="itest-uptodate">
			<and>
				<!-- always run tests unless this property has been set -->
				<isset property="itest.uptodate.on"></isset>
				<uptodate>
					<!--if no changes in target source - compare *.java to *.class timestamps-->
					<srcfiles dir="${src.java.dir}" includes="**/*.java"></srcfiles>
					<srcfiles dir="${gen.java.dir}" includes="**/*.java"></srcfiles>
					<srcfiles dir="${xdoclet.build.java.dir}" includes="**/*.java"></srcfiles>
					<mapper type="glob" from="*.java" to="${target.classes.dir}/*.class"></mapper>
				</uptodate>
				<uptodate>
					<!--if no changes in unit test source - compare *.java to *.class timestamps-->
					<srcfiles dir="${src.itest.dir}" includes="**/*.java"></srcfiles>
					<srcfiles dir="${gen.itest.dir}" includes="**/*.java"></srcfiles>
					<mapper type="glob" from="*.java" to="${build.itest.war.classes.dir}/*.class"></mapper>
				</uptodate>
				<uptodate>
					<!--if no changes in target resources (non-source) - compare timestamps on files in src and classes directories -->
					<srcfiles dir="${src.itest.dir}" excludes="**/*.java"></srcfiles>
					<srcfiles dir="${gen.itest.dir}" excludes="**/*.java"></srcfiles>
					<mapper type="glob" from="*" to="${build.itest.war.classes.dir}/*"></mapper>
				</uptodate>
				<not>
					<!--always run tests if single unit test class spacified -->
					<isset property="itestcase"></isset>
				</not>
				<or>
					<not>
						<!-- this check is not applicable to console tests -->
						<isset property="testreports"></isset>
					</not>
					<uptodate>
						<!-- run test if any report fragments (compared with test source) are missing or not uptodate-->
						<srcfiles dir="${src.itest.dir}" includes="**/*.java"></srcfiles>
						<srcfiles dir="${gen.itest.dir}" includes="**/*.java"></srcfiles>
						<mapper type="package" from="${itest.uptodate.pattern}.java" to="${build.itest.reports.dir}/TEST-${itest.uptodate.pattern}.xml"></mapper>
					</uptodate>
				</or>
				<not>
					<!--run tests if last test failed (indicated by this file not being erased)-->
					<available file="${itest.last.failed.file}"></available>
				</not>
			</and>
		</condition>
		<echo>itest-uptodate = ${itest-uptodate}, testreports = ${testreports}</echo>
		<!-- determine which target to run based on 'testreports' property -->
		<condition property="skip.itest.console">
			<or>
				<isset property="testreports"></isset>
				<isset property="itest-uptodate"></isset>
			</or>
		</condition>
		<condition property="skip.itest.reports">
			<or>
				<not>
					<isset property="testreports"></isset>
				</not>
				<isset property="itest-uptodate"></isset>
			</or>
		</condition>
	</target>
	<!-- =================================================================== -->
	<!-- run unit test(s) sending results to console -->
	<!-- =================================================================== -->
	<target name="itest.console" unless="skip.itest.console">
		<echo>itestcase = ${itestcase}</echo>
		<junit printsummary="true" errorProperty="itest.failed" failureProperty="itest.failed" fork="${itest.fork}">
			<classpath refid="cactus.run.classpath"></classpath>
			<formatter type="plain" usefile="false"></formatter>
			<test name="${itestcase}" if="itestcase"></test>
			<batchtest todir="${build.itest.reports.dir}" unless="itestcase">
				<fileset dir="${src.itest.dir}">
					<patternset refid="itest.batchtest.patternset"></patternset>
				</fileset>
				<fileset dir="${gen.itest.dir}">
					<patternset refid="itest.batchtest.patternset"></patternset>
				</fileset>
			</batchtest>
		</junit>
		<echo message="last build failed tests" file="${itest.last.failed.file}"></echo>
	</target>
	<!-- =================================================================== -->
	<!-- run integration test(s) producing report -->
	<!-- =================================================================== -->
	<target name="itest.report" unless="skip.itest.reports">
		<echo>itestcase = ${itestcase}</echo>
		<delete dir="${build.test.docs.dir}" failonerror="false"></delete>
		<delete dir="${build.itest.reports.dir}" failonerror="false"></delete>
		<mkdir dir="${build.test.docs.dir}"></mkdir>
		<mkdir dir="${build.itest.reports.dir}"></mkdir>
		<junit printsummary="true" errorProperty="itest.failed" failureProperty="itest.failed" fork="${itest.fork}">
			<classpath refid="cactus.run.classpath"></classpath>
			<formatter type="xml"></formatter>
			<test name="${itestcase}" todir="${build.itest.reports.dir}" if="itestcase"></test>
			<batchtest todir="${build.itest.reports.dir}" unless="itestcase">
				<fileset dir="${src.itest.dir}">
					<patternset refid="itest.batchtest.patternset"></patternset>
				</fileset>
				<fileset dir="${gen.itest.dir}">
					<patternset refid="itest.batchtest.patternset"></patternset>
				</fileset>
			</batchtest>
		</junit>
		<junitreport todir="${build.test.docs.dir}">
			<fileset dir="${build.itest.reports.dir}">
				<include name="TEST-*.xml"></include>
			</fileset>
			<report format="noframes" todir="${build.test.docs.dir}"></report>
		</junitreport>
	</target>
	<!-- =================================================================== -->
	<!-- fail if tests failed otherwise erase itest.last.failed.file -->
	<!-- =================================================================== -->
	<target name="itest.fail">
		<echo message="last build failed tests" file="${itest.last.failed.file}"></echo>
		<fail message="Unit test(s) failed. Check log and/or reports directory." if="itest.failed"></fail>
		<!-- Remove test failed file, as these tests succeeded -->
		<delete file="${itest.last.failed.file}" failonerror="false"></delete>
	</target>
</project>