Java Reference
In-Depth Information
Figure 9.2
Ant output with Ivy at work
9.7
Creating HTML reports
The console output from figure 9.1 might be acceptable when you're running tests
interactively, but you can't use the output if you want to examine the results later. A
(cron) job or a continuous integration server (see chapter 11) might run the tests
automatically every day such that the console output might not be available.
The
junit
task can produce
XML
documents detailing the results of various test
runs. Another optional Ant task,
junitreport
, transforms this
XML
into
HTML
using
an
XSL
stylesheet. The result is a report you can view with any web browser. Figure 9.3
shows a report page for the
example
project.
Listing 9.6 shows the changes necessary (in bold) to the build file to generate
this report.
Listing 9.6
Adding a
JUnitReport
task to the build file
<project name="example" default="test">
[...]
<property name="target.report.dir" location="${target.dir}/report"/>
[...]
B