Can't get build to fail with junit, ant, and cruisecontrol

Can't get build to fail with junit, ant, and cruisecontrol

Post by davi » Thu, 17 Apr 2003 10:51:47

I'm using CruiseControl and Ant to perform these steps:

2)start weblogic server
3)run unit tests and reports
4)shutdown weblogic
5)send email if build fails, which i want to include unit tests
with failures, or errors

everything works fine, except the unit tests will not cause the build
to fail
even though i use the fail task if failureproperty is set in the junit

if a target fails, shouldn't the build?

here's the skeleton for my CC-build.xml and my main project's

******* the target called in CruiseControl-build.xml*************

<target name="clean-build-test"  depends="clean,vssget" >
    <ant antfile="${vss.local.path}/build/build.xml"
target="build-all-test"       inheritall="true" />
 <antcall target="labelbuild" />

************* target called = "build-all-test" *********************

<project name="Main Build Script" default="build" basedir="..">

  <target name="test" >

        <junit haltonfailure="on" printsummary="true"
errorproperty="unit.test.failure" >


         <junitreport  .>




  <target name="build-all-test" depends="init"
                     description="runs build-all, starts WLS,  runs
tests, and shuts down WLS">

           <antcall target="build-all"/>
                   <antcall target="startWebLogic"/>
                    <sequential >
                        <sleep seconds="120"/>
                        <antcall target="test"/>
                        <antcall target="shutdownWebLogic"/>
        <fail if="unit.test.failure"></fail>



1. Did anyone use 'batchtest' of ant's junit task?

Did anyone use 'batchtest' of ant's junit task?

I'm using junit batchtest to run all the files **Test*.java using pattern
matching. Ant is running junit on these files and logging the test results to
files named TEST-name.txt for each matching file in the directory.

Suppose if there are 3 matching files,, and, the results are collected in 3 files TEST-SimpleTest.txt,
TEST-VectorTest.txt, and TEST-MonetTest.txt.

Is there a way to collect the results of all the tests in a single
"results.txt" file instead of ant creating one results file for each matching

Ant is not allowing me to put the attribute "outfile=results.txt" either in
the 'fileset' or in the 'batchtest' tags.

Please help!  Thank You so much!


My build file is given below:

<?xml version="1.0"?> <project name = "Ant_Test" default="test" basedir=".">
<property name="classpath"
er.jar;C:\ant\lib\optional.jar;C:\ant\.;" />

<property name="srcdir" value="ant" />

<target name="test">
<junit printsummary="yes" haltonfailure="no">

<classpath>     <pathelement location="${srcdir}" />
                <pathelement path="${classpath}" />

<formatter type="plain" /> <!-- <test name="junit.samples.SimpleTest"
haltonfailure="no" outfile="Test_results"> </test> -->

<batchtest fork="yes">
        <fileset dir="${srcdir}" excludes="**\src\**">
                <include name="**/*Test*.java" />
                <exclude name="**/" />




Sent via

2. Streaming Video with Windows Media Player

3. JUnit 3.7 and Ant 1.4 Property definitions - don't work

4. plotting to lpt1

5. Did anyone use Ant's junit task?

6. dots&boxes on torus

7. Cruisecontrol continuous integration wrapper for Ant

8. FWP

9. Test cases organization (JUnit, Ant...)

10. JUnit + Ant + lazy developers

11. Test cases organization (JUnit, Ant...)

12. Ant build files and c++