Reputation: 33591
I have a number of tests failing in the following JUnit Task.
<target name="test-main" depends="build.modules" description="Main Integration/Unit tests">
<junit fork="yes"
description="Main Integration/Unit Tests"
showoutput="true"
printsummary="true"
outputtoformatters="true">
<classpath refid="test-main.runtime.classpath"/>
<batchtest filtertrace="false" todir="${basedir}">
<fileset dir="${basedir}" includes="**/*Test.class" excludes="**/*MapSimulationTest.class"/>
</batchtest>
</junit>
</target>
How do I tell Junit to ouput the errors for each test so that I can look at the stack trace and debug the issues.
Upvotes: 17
Views: 8564
Reputation: 6730
You'll need to add the formatter task as a child of the batchtest task (NOT as the immediate child of the junit task)
The syntax of formatter is:
<formatter type="plain" usefile="false"/>
type
can be one of plain
, brief
, xml
or failure
.
usefile="false"
asks Ant to send output to the console.
Scroll down to the h4 on "formatters" at http://ant.apache.org/manual/Tasks/junit.html for more details.
Upvotes: 18
Reputation: 33591
The answer was to add the tag within the tag.
<target name="test-main" depends="build.modules" description="Main Integration/Unit tests">
<junit fork="yes"
description="Main Integration/Unit Tests"
showoutput="true"
printsummary="true"
outputtoformatters="true">
<classpath refid="test-main.runtime.classpath"/>
<batchtest filtertrace="false">
<fileset dir="${basedir}/out/test/common" includes="**/*Test.class" excludes="**/*MapSimulationTest.class"/>
<fileset dir="${basedir}/out/test/test-simulation" includes="**/*Test.class" excludes="**/*MapSimulationTest.class"/>
</batchtest>
<formatter type="brief" usefile="false"/>
</junit>
</target>
Upvotes: 9