Reputation: 33046
I've seen a couple of posts about this but none provide the solution I'm looking for. I have ant set up so when it runs our tests we get the following output (which I like):
[junit] Running net.windward.document.test.TestTab
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.59 sec
[junit] Running net.windward.document.test.TestTableAttributes
[junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.604 sec
... continues for 300+ tests ...
But then at the end I just get "some tests failed". Is there some way to have it then list out the filenames of the tests that have failed?
thanks - dave
build.xml:
<junit printsummary="yes" errorProperty="test.failed" failureProperty="test.failed" >
<formatter type="plain" />
<classpath path="${classpath.run.test}"/>
<batchtest fork="yes" todir="${reports}">
<fileset dir="${src}">
<include name="**/test/**/Test*.java" />
<exclude name="**/_*/**/*.java" />
</fileset>
</batchtest>
</junit>
<fail if="test.failed" message="one or more unit tests failed"/>
<echo>unit tests all passed</echo>
<antcall target="testinternal"/>
</target>
Upvotes: 2
Views: 1807
Reputation: 399
Read chapter 4 of "Java Development with Ant": http://www.manning-source.com/books/hatcher/hatcher_ch04.pdf
You can use
<formatter type="xml" />
to generate an xml output of the tests. This can be converted to html to view it in a browser after all tests have run using the ant task junitreport. You can also import the xml file into eclipse if you use it.
Upvotes: 1