Ant Junit Task mishandles Suites

Published:
Reading time:
About 1 min

Maybe I’m missing something, but the Ant Junit task doesn’t seem to handle Suites well. What I mean is that the formatters supplied with the base Junit task, when outputting information about a suite, don’t spit out details about the class that a test was in. Socan’t even display this information in the html.

For instance if I had two tests, one in TestClass1 and another in TestClass2 named testMyMethod() and run from the suite AllTests, the output fromnot distinguish between the two tests.

The “work around” is to use thenested element and specify a:
<fileset includes=“/*.class" excludes="/AllTests.class” />
However, this runs slower than using test suites.

I did see that in 1.6.2 there will be a new option to fork a single JVM instead of one for each class, but even then this could run faster through test suites.

So for now I have added a vote to bug #24106. I encourage anyone else that is annoyed by this to do the same!