ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Stör <>
Subject [Junit] How to handle TestSuites correctly
Date Tue, 30 Aug 2005 11:40:58 GMT
Hi all,

We're having major difficulties using the junit/junitreport targets with
JUnit TestSuites.

Usually, the junit target produces an XML file for each test class and
junitreport produces a superb report based on those files. In our case,
however, we end up with one XML file only since our TestSuite (which of
course contains several test cases) is treated as one single test case.
Accordingly only one HTML report is produced. It lists all tests (i.e. test
methods), but we loose the reference to the test class that defines the test
method. Here is a screenshot:

Any ideas how to get a report showing the test class as well?

Here is the ANT code:

<junit haltonerror="false" showoutput="true" errorProperty="test.failed"
 <classpath refid="compile.classpath" />
 <formatter type="xml" usefile="true" />
 <batchtest fork="yes" todir="${reports.tests}">
  <fileset dir="${src.tests}">
   <include name="**/" />

<junitreport todir="${reports.tests}">
 <fileset dir="${reports.tests}">
  <include name="TEST-*.xml" />
 <report format="frames" todir="${reports.tests}/html/" />

<fail if="test.failed">
 Unit tests failed.  Check log or reports for details.

Here is our JUnit Java code:

    public static TestSuite suite() {
        final TestSuite allTests = new TestSuite("All Tests");

        return allTests;

Marcel Stör

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

View raw message