ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sauyet, Scott (OTS-HAR)" <Scott_Sau...@output.net>
Subject RE: Determining if your unit tests pass/fail when running them fr om Ant
Date Thu, 08 May 2003 18:19:41 GMT
> Is there a way to determine if my unit tests fail when executed through
Ant?
> Is there a return value that I should look for? I need to detect something
> like this through a shell script....

I'm not an expert.  I don't even play one on TV.

But I am reading a book written by experts, Erik Hatcher's and Steve
Loughran's
_Java Development with Ant_.  They make the following recommendation for
capturing
JUnit failures after writing the JUnit reports:


  <target name="test" depends="test-compile">
    <junit printsummary="no"
           errorProperty="test.failed"
           failureProperty="test.failed"
           fork="${junit.fork}">
        [ ... ]
    </junit>

    <junitreport todir="${test.data.dir}">
        [ ... ]
    </junitreport>

    <fail message="Tests failed. Check log and/or reports."
if="test.failed"/>
  </target>

If you don't want to generate the reports, then the junit task has a
"haltonfailure"
attribute.  If you don't want to fail the build, but simply return status,
perhaps
you could write the "test.failed" property to a file and read that from your
shell
job?

Good luck,

  -- Scott

Mime
View raw message