concept < junit in category ant

appears as: <junit, <junit
Ant in Action

This is an excerpt from Manning's book Ant in Action.

This tells us two things. First, our code is broken and second, we need <junit> to tell us what failed and stop the build afterwards.

Adding the reporting to our routine is simply a matter of setting haltonfailure="false" in <junit> so the build continues after the failure, then declaring the <junitreport> task after the <junit> run:

Listing 14.4. Targets to deploy the EAR file and run the Cactus test suite
<target name="cactus-deploy" depends="cactus-ear"> <copy file="${cactus.ear}" tofile="${cactus.destfile}" overwrite="true"/> <echo>deployed: ${cactus.destfile}</echo> </target> <target name="cactus-run" depends="test-classpaths,cactus-init,cactus-deploy,wait"> <get src="${cactus.url}/happyx.jspx" dest="${build.dir}/happyx.html"/> <junit errorProperty="cactus.failed" failureProperty="cactus.failed"> <classpath> <path refid="test.classpath"/> </classpath> <sysproperty key="cactus.contextURL" value="${cactus.url}"/> <sysproperty key="server.url" value="${cactus.url}"/> <formatter type="brief" usefile="false"/> <formatter type="xml"/> <batchtest todir="${test.data.dir}"> <fileset dir="test"> <include name="**/*Test.java"/> </fileset> </batchtest> </junit> <delete file="${cactus.destfile}"/> <junitreport todir="${test.data.dir}"> <fileset dir="${test.data.dir}"> <include name="TEST-*.xml"/> </fileset> <report format="frames" todir="${test.reports.dir}"/> </junitreport> <fail if="cactus.failed"> Tests failed. Check ${test.reports.dir} </fail> </target>