Can Gradle's test report support nested TestSuites?

When IntelliJ runs a TestSuite, its report preserves the nested TestSuite structure. For example,

is generated by the following:

package tests3p0;
  import junit.framework.TestCase;
import junit.framework.TestSuite;
  public class Suite1 extends TestCase {
    public static TestSuite suite() {
        TestSuite suite = new TestSuite();
        suite.addTest(new Test1());
        suite.addTest(new Test2());
        suite.addTestSuite(SubSuite.class);
          return suite;
    }
}
  class Test1 extends TestCase {
    public Test1() {
        super("test1");
    }
      @Override
    protected void runTest() throws Throwable {
        System.out.println("test1");
    }
}
  class Test2 extends TestCase {
    public Test2() {
        super("test2");
    }
      @Override
    protected void runTest() throws Throwable {
        System.out.println("test2");
    }
}
  package tests3p0;
  import junit.framework.TestCase;
  public class SubSuite extends TestCase {
    public SubSuite() {
    }
      public void testMe() {
        System.out.println("tested");
    }
}

The equivalent HTML report produced by gradle squashes test1, test2, and testMe into a single level under Suite1.

Is there a way to preserve the nested structure in the generated HTML report?

Have you tried JUnit 4 suites (rather than JUnit 3)? That might give better results.

As far as I can tell, both IntelliJ’s output and Gradle’s output behave exactly the same regardless of whether I extend TestCase, or use ‘@Test’, ‘@RunWith(Suite.class)’, and ‘@Suite.SuiteClasses(…)’.

That is, in both cases IntelliJ preserves the nesting while Gradle squashes it.

Right, I can reproduce this. See the related fix/discussion at http://issues.gradle.org/browse/GRADLE-2649.