Question

We're currently using JUnit 4.4 and Ant 1.7.1 for our builds. I have some test cases that are @Ignored. When I run them in Eclipse, the JUnit test runner reports them as ignored. I would like to see them listed in the XML output from Ant (so I can report on them), but they do not seem to be there.

Does anyone have this working? Is there a switch to turn them on? An upgrade I need to do?

Was it helpful?

Solution

It looks like this is a known Ant issue/bug.

OTHER TIPS

This thread talks about the same issue, but it provides some additional information: you can get data on ignored tests when running the tests using maven surefire, and hudson is able to display that data.

http://jenkins.361315.n4.nabble.com/Is-it-possible-to-show-Ignore-JUnit-tests-td1565288.html

A fix for this issue has now been applied to the head of Ant core, scheduled for release as part of the upcoming version of Ant 1.9.0.

It should be possible to try this fix locally be replacing ant-junit.jar in your Ant distribution's lib directory with the version from the nightly builds, or by running the full nightly Ant distribution, or by building the Ant sources directly. Since the Ant team are currently voting on preparing a new release it may just be worth waiting for 1.9.0 to be officially packaged and pushed out for download.

Just tried Ant 1.9.0 with JUnit 4.11. If you use <junit printsummary="on"> you'll get output like:

[junit] Running com.example.IgnoredTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.01

[junit] Running com.example.PassingTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01

[junit] Running com.example.FailingTest
[junit] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.01

I think it'd be preferrable if we could get output like this with printsummary=off:

[junit] Test com.example.IgnoredTest SKIPPED
[junit] Test com.example.FailingTest FAILED

but it seems the more verbose output above is the best we can do, unless I'm missing some obscure trick with one of the junit task arguments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top