You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Sauyet, Scott (OTS-HAR)" <Sc...@output.net> on 2003/05/08 20:19:41 UTC
RE: Determining if your unit tests pass/fail when running them fr
om Ant
> 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