ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Abley <>
Subject JUnit task and TestSuite hierarchy
Date Mon, 13 Dec 2004 12:35:44 GMT

This has been previously discussed - see

I have some nested test suites and the standard XMLJUnitResultFormatter
doesn't allow nested test suites, since the document root element is
"testsuite". I would like the output to be something like this:

MyTestSuite with custom name
  + FirstTestSuite with custom name
    + firstTestMethod
    + secondTestMethod
  + SecondTestSuite, also with custom name
    + firstTestMethod
    + secondTestMethod

But instead it is flattened like so:

MyTestSuite class name
  + firstTestMethod
  + secondTestMethod
  + firstTestMethod
  + secondTestMethod

When I have a thousand tests, it's a little hard to work out which
particular one failed, particularly when the suite name was intended to
provide that information. I could provide more detail in the
assertEquals call, if one remembers. But that's duplicated effort - I
want to only specify that once, just after test suite creation, rather
than in each assertion in each test method.

The above thread talked about a custom formatter, but after a look at
the JUnitResultFormatter interface and XMLJUnitResultFormatter
implementation, I suspect that ant doesn't currently provide the same
events that the JUnit swingui TestRunner and the version in the Eclipse
IDE do, which both present a hierarchical view of the TestSuite
composition. Also, I have the same issue that JUnitTest doesn't
recognise TestSuite names, just the class name. 

This leads me to think that I need to create new task which exposes the
events that I need, and will use the TestSuite.getName() method, rather
than JUnitTest.getName(). Has anyone else had this problem and how was
it solved, before I start looking at how much work it might be to create
a new JUnit2 task?

Thanks in advance,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message