java left logo
java middle logo
java right logo

Home arrow Other API Tips
Main Menu
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog

Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews

Registered Users: 4118
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
How to use JUnitReport task E-mail
User Rating: / 24


Merge the individual XML files generated by the JUnit task and eventually apply a stylesheet on the resulting merged document to provide a browsable report of the testcases results.

Note: This task depends on external libraries not included in the Ant distribution. See Library Dependencies for more information.


The task needs Apache Xalan 2.x or Xalan XSLTC (JDK 1.4 contains a version of Xalan-J 2.x while JDK 1.5 ships with a version of XSLTC). Versions prior to Ant 1.6.2 worked with Apache Xalan 1.2.2, but as Xalan1 is no longer supported, we do not recommend this. With Ant 1.6.2 we had to decide between supporting Xalan-J 1 and XSLTC, since there was no way to support both at the same time.

If you want to use Xalan 1.2.2, the noframes report is still supposed to work. If you want the frames support, copy the file junit-frames-xalan1.xsl from the Ant distribution's etc directory to a new directory, change its name to junit-frames.xsl and use the task's styledir attribute to point to it. You will also need a compatible (older) version of Xerces. as well as BSF(bsf.jar). Again, using Xalan 2 is simpler and supported.


Attribute Description Required
tofile The name of the XML file that will aggregate all individual XML testsuite previously generated by the JUnit task. No. Default to TESTS-TestSuites.xml
todir The directory where should be written the file resulting from the individual XML testsuite aggregation. No. Default to current directory

Nested Elements


junitreport collects individual xml files generated by the JUnit task using the nested <FileSet> element.


Generate a browsable report based on the document created by the merge.


Attribute Description Required
format The format of the generated report. Must be "noframes" or "frames". No, default to "frames"
styledir The directory where the stylesheets are defined. They must be conforming to the following conventions:
  • frames format: the stylesheet must be named junit-frames.xsl.
  • noframes format: the stylesheet must be named junit-noframes.xsl.
No. Default to embedded stylesheets.
todir The directory where the files resulting from the transformation should be written to. No. Default to current directory

Example of report

<junitreport todir="./reports">
  <fileset dir="./reports">

    <include name="TEST-*.xml"/>
  <report format="frames" todir="./report/html"/>

would generate a TESTS-TestSuites.xml file in the directory reports and generate the default framed report in the directory report/html.

Source: Apache Ant

 Related Tips

< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.

Name (required)

E-Mail (required)

Your email will not be displayed on the site - only to our administrator

Comment Enable HTML code : Yes No

java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008
Java is a trademark of Sun Microsystems, Inc.