ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Hatton" <>
Subject RE: if junit batchtest is skipped also skip junitreport?
Date Mon, 28 Feb 2005 17:16:37 GMT
I recently did this but was unable to do it with a purely macrodef-based
The gist of my solution was to define the fileset generated by Junit.

    <fileset id="junit.raw" dir="${blah}" includes="TEST-*.xml"/>
Then check if it was actually there:

    <target name="junitcheck">
        <!-- did we actually run any unit tests? -->
        <pathconvert targetos="windows" refid="junit.raw"
            property="report.junit" setonempty="false"/>
Then only do the junitreport if the property was set:

    <target name="junitreports" depends="junitcheck" if="report.junit">
            <fileset refid="junit.raw"/>
            <report format="frames" todir="${report}"/>

Hope thie helps, and if anyone has more elegant solutions I'd be
delighted to hear them!


-----Original Message-----
From: Jon Jagger [] 
Sent: 28 February 2005 15:03
Subject: if junit batchtest is skipped also skip junitreport?

I have a package based ant setup which uses the following...

<macrodef name="run-test"
    <attribute name="package"//>
       <junit errorProperty="test.failed" ...>
          <formatter type="xml"/>
          <batchtest todir="..."
        <fail if="test.failed"/>
        <junitreport todir="....>

This works but I'd like to run the junitreport only if batchtest 
actually runs some tests. In other words, I like an unless on 
junitreport to mirror the unless on batchtest. But there isn't one and I

can't see an obvious answer in chapter 4 of Erik & Steve's excellent ant

book. Is there a way to do this without resorting to the <if>

Also, I'm using a flag file to indicate whether a test-run passed or 
failed. That way I can rerun the tests even if none of the code being 
tested or the code doing the tests has changed. Exactly as Erik and 
Steve suggest in chapter 4 (pages 106-108). Is there a way to stop the 
<delete> task from echoing a successful deletion message to the console?

Many thanks


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message