Bug 42519

Summary: Incomplete Junit reporter
Product: Ant Reporter: Andrey <iostream>
Component: Optional TasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: normal CC: jglick
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://issues.apache.org/bugzilla/show_bug.cgi?id=48529

Description Andrey 2007-05-25 09:10:43 UTC
If we have following test:

class AAA{
public static Test suite() {
   TestSuite suite = new TestSuite();
   suite.setName("AllTests"); 
   TestSuite test1 = new TestSuite();
   test1.setName("Test1");
   test1.addTest(new ATestCase("testA"));
   test1.addTest(new ATestCase("testB"));
   TestSuite test2 = new TestSuite();
   test2.setName("Test2");
   test2.addTest(new BTestCase("testC"));
   test2.addTest(new BTestCase("testD"));
   suite.addTest(test1);
   suite.addTest(test2);

   return suite;
}
......

After run tests -
<junit>
  <test name="AAA" outfile="AAA" todir="AAA"/>
  <formatter type="xml"/>
</junit>

we have following XML:

<testsuite errors="0" failures="0" name="AAA" tests="4" time="1.701">
....
   <testcase classname="ATestCase" name="testA" time="0.047"/>
   <testcase classname="ATestCase" name="testB" time="0.047"/>
   <testcase classname="BTestCase" name="testC" time="0.047"/>
   <testcase classname="BTestCase" name="testD" time="0.047"/>
....
<testsuite/>

but is better to get like following:
<testsuite errors="0" failures="0" name="AllTests" tests="4" time="1.701">
....
   <testsuite errors="0" failures="0" name="Test1">
      <testcase classname="ATestCase" name="testA" time="0.047"/>
      <testcase classname="ATestCase" name="testB" time="0.047"/>
   <testsuite/>
   <testsuite errors="0" failures="0" name="Test2">
      <testcase classname="BTestCase" name="testC" time="0.047"/>
      <testcase classname="BTestCase" name="testD" time="0.047"/>
   <testsuite/>
....
<testsuite/>
Comment 1 J. David Beutel 2007-06-27 20:49:45 UTC
I agree, this would be nice.  The current report doesn't really recognize
suites, despite the element name "testsuite".  It is organized by package and
has only a single level of classes.  I guess you want an option to organize the
report by suite, and an intermediate XML format to support that.  This might be
appropriate for the legendary junit4 antlib.
Comment 2 Andrei Costescu 2012-12-06 16:58:35 UTC
See 48529. I did a patch for this, but it didn't get any attention right away. Don't know how hard it is to merge that to the latest version.
Comment 3 Jesse Glick 2012-12-06 18:13:53 UTC
Duplicate of bug #48529?