ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samuel Langlois" <>
Subject Re: JUnit task and test suites
Date Wed, 27 Aug 2003 16:44:45 GMT

Thanks for looking into my request.

> > Although this is correctly executed, Ant's JUnit test runner
> > "flattens" the test structure, and we end up with all test cases at
> > the same level.
> Is it really the runner or the report that is disturbing you?
Indeed, the limitation lies in the report generated by the runner,
(i.e. the <junit> Ant task. I am not talking of the <junitreport> task!)

> I haven't used any TestRunner other than Ant's or textui for a couple
> of JUnit releases now, so I don't really know what swingui would look
> like with a nested hierarchy of TestSuites as you describe it.
> What exactly would you like to see that Ant's current implementation
> doesn't give to you?
Using swingui.TestRunner on the example I gave, you would get
the following hierarchy:

+- Suite A
   +- Testing A
+- Suite B
  +- Testing B

(I attach an image file to make it clearer...)
As you can see, the top-level TestSuite contains two sub-TestSuites
named Suite A and Suite B, each one containing one TestCase.

Now, in the XML report generated by Ant, you get something like:
<testsuite errors="0" failures="0" name="GeneratedSuite" tests="2" time="0.694">
  <snip>list of properties</snip>
  <testcase name="Testing A" time="0.0070"></testcase>
  <testcase name="Testing B" time="0.0"></testcase>

Here, there is no mention of Suite A or Suite B, the only "testsuite"
is named GeneratedSuite, which is not the name of a TestSuite,
but the name of the Java class which created the TestSuites.
And the two test cases are put side by side, without showing
to which suite they belong.

The ideal report would keep the TestSuite hierarchy that was built
using the JUnit API, by adding another level in the XML, something like:
<report name="GeneratedSuite">
  <testsuite name="Suite A">
    <testcase name="Testing A" time="0.0070"></testcase>
  <testsuite name="Suite B">
    <testcase name="Testing B" time="0.0"></testcase>
Of course, <testsuite> could not only contain <testcase> tags but also
other <testsuite>, because you can have a multi-level tree.

I understand this would be a big change to make, and I'm not expecting
any change in the product soon!
I only wanted to raise that point and, if possible, get hints or workarounds
from people who had bumped in the same problem.

Hope this makes things clearer !


View raw message