1 | <!--
|
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | contributor license agreements. See the NOTICE file distributed with
|
---|
4 | this work for additional information regarding copyright ownership.
|
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | (the "License"); you may not use this file except in compliance with
|
---|
7 | the License. You may obtain a copy of the License at
|
---|
8 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 | <head>
|
---|
19 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
20 | <title>JUnitReport Task</title>
|
---|
21 | </head>
|
---|
22 |
|
---|
23 | <body>
|
---|
24 |
|
---|
25 | <h2><a name="junitreport">JUnitReport</a></h2>
|
---|
26 | Merge the individual XML files generated by the JUnit task and eventually apply
|
---|
27 | a stylesheet on the resulting merged document to provide a browsable report of
|
---|
28 | the testcases results.
|
---|
29 | <p><strong>Note:</strong> This task depends on external libraries not included in
|
---|
30 | the Ant distribution. See <a href="../install.html#librarydependencies">
|
---|
31 | Library Dependencies</a> for more information.</p>
|
---|
32 |
|
---|
33 | <h3>Requirements</h3>
|
---|
34 |
|
---|
35 | <p>The task needs Apache <a
|
---|
36 | href="http://xml.apache.org/xalan-j/">Xalan 2.4.1+ or Xalan XSLTC</a>
|
---|
37 | (JDK 1.4 contains a version of Xalan-J 2.x while JDK 1.5 ships with a
|
---|
38 | version of XSLTC). Starting from JDK 1.4.2-01 it ships with a bundled
|
---|
39 | Xalan-J 2.4.1+, meaning that JDK version prior to 1.4.2-01 won't work
|
---|
40 | out of the box. The table below summarize the compatibility status.
|
---|
41 | </p>
|
---|
42 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
43 | <tr><th>Xalan</th><th>Sun JDK Bundle</th><th>Status<th></tr>
|
---|
44 | <tr><td>2.4.1+</td><td>JDK 1.4.2-01+</td><td>OK</td></tr>
|
---|
45 | <tr><td>XSLTC</td><td>JDK 1.5.x</td><td>OK</td></tr>
|
---|
46 | <tr><td>2.x</td><td>JDK 1.4.x</td><td>DEPRECATED<br><i>Use ${ant.home}/etc/junit-frames-xalan1.xsl
|
---|
47 | <br> Upgrade Xalan using the JDK endorsement mechanism</i></td></tr>
|
---|
48 | </table>
|
---|
49 |
|
---|
50 | <p>With Ant 1.6.2 we had to decide between supporting Xalan-J 1/Xalan J 2.4.1-
|
---|
51 | and Xalan 2.4.1+/XSLTC, since there was no way to support both couples at the same
|
---|
52 | time.</p>
|
---|
53 | <p>With Ant 1.7 we had to drop support Xalan-J 1, since Xalan-J 1 has not
|
---|
54 | available anymore for quite some time.</p>
|
---|
55 |
|
---|
56 | <h3>Parameters</h3>
|
---|
57 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
58 | <tr>
|
---|
59 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
60 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
61 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
62 | </tr>
|
---|
63 | <tr>
|
---|
64 | <td valign="top">tofile</td>
|
---|
65 | <td valign="top">The name of the XML file that will aggregate all individual
|
---|
66 | XML testsuite previously generated by the JUnit task.</td>
|
---|
67 | <td align="center" valign="top">No. Default to TESTS-TestSuites.xml</td>
|
---|
68 | </tr>
|
---|
69 | <tr>
|
---|
70 | <td valign="top">todir</td>
|
---|
71 | <td valign="top">The directory where should be written the file resulting
|
---|
72 | from the individual XML testsuite aggregation.</td>
|
---|
73 | <td align="center" valign="top">No. Default to current directory</td>
|
---|
74 | </tr>
|
---|
75 | </table>
|
---|
76 | <h3><a name="nested">Nested Elements</a></h3>
|
---|
77 | <h4>fileset</h4>
|
---|
78 | <p><code>junitreport</code> collects individual xml files generated by the JUnit
|
---|
79 | task using the nested <a href="../CoreTypes/fileset.html"><code><FileSet></code></a>
|
---|
80 | element.</p>
|
---|
81 | <h4>report</h4>
|
---|
82 | <p>Generate a browsable report based on the document created by the merge.</p>
|
---|
83 | <h3>Parameters</h3>
|
---|
84 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
85 | <tr>
|
---|
86 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
87 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
88 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
89 | </tr>
|
---|
90 | <tr>
|
---|
91 | <td valign="top">format</td>
|
---|
92 | <td valign="top">The format of the generated report. Must be "noframes"
|
---|
93 | or "frames".</td>
|
---|
94 | <td align="center" valign="top">No, default to "frames"</td>
|
---|
95 | </tr>
|
---|
96 | <tr>
|
---|
97 | <td valign="top">styledir</td>
|
---|
98 | <td valign="top">The directory where the stylesheets are defined. They must
|
---|
99 | be conforming to the following conventions:
|
---|
100 | <ul>
|
---|
101 | <li>frames format: the stylesheet must be named <i>junit-frames.xsl</i>.</li>
|
---|
102 | <li>noframes format: the stylesheet must be named <i>junit-noframes.xsl</i>.</li>
|
---|
103 | </ul>
|
---|
104 | </td>
|
---|
105 | <td align="center" valign="top">No. Default to embedded stylesheets.</td>
|
---|
106 | </tr>
|
---|
107 | <tr>
|
---|
108 | <td valign="top">todir</td>
|
---|
109 | <td valign="top">The directory where the files resulting from the
|
---|
110 | transformation should be written to.</td>
|
---|
111 | <td align="center" valign="top">No. Default to current directory</td>
|
---|
112 | </tr>
|
---|
113 | </table>
|
---|
114 | <p> Ant assumes the following concerning the <tt>frames</tt> and <tt>noframes</tt> formats :</p>
|
---|
115 | <p>The <tt>frames</tt> format uses
|
---|
116 | a stylesheet which is generating output <em>only</em> by redirecting.</p>
|
---|
117 | <p>The
|
---|
118 | <tt>noframes</tt> format does not use redirecting and generates one
|
---|
119 | file called <tt>junit-noframes.html</tt>.</p>
|
---|
120 | <p>Custom versions of <tt>junit-frames.xsl</tt> or <tt>junit-noframes.xsl</tt> must adhere to the above conventions.</p>
|
---|
121 |
|
---|
122 | <h3>Nested Element of the report tag</h3>
|
---|
123 | <h4>param</h4>
|
---|
124 | <em>Since Ant 1.7</em>the report tag supports nested param tags.
|
---|
125 | These tags can pass XSL parameters to the stylesheet.
|
---|
126 | <h3>Parameters</h3>
|
---|
127 | <table width="60%" border="1" cellpadding="2" cellspacing="0">
|
---|
128 | <tr>
|
---|
129 | <td valign="top"><b>Attribute</b></td>
|
---|
130 | <td valign="top"><b>Description</b></td>
|
---|
131 | <td align="center" valign="top"><b>Required</b></td>
|
---|
132 | </tr>
|
---|
133 | <tr>
|
---|
134 | <td valign="top">name</td>
|
---|
135 | <td valign="top">Name of the XSL parameter</td>
|
---|
136 | <td align="center" valign="top">Yes</td>
|
---|
137 | </tr>
|
---|
138 | <tr>
|
---|
139 | <td valign="top">expression</td>
|
---|
140 | <td valign="top">Text value to be placed into the param.<br>
|
---|
141 | Was originally intended to be an XSL expression.</td>
|
---|
142 | <td align="center" valign="top">Yes</td>
|
---|
143 | </tr>
|
---|
144 | <tr>
|
---|
145 | <td valign="top">if</td>
|
---|
146 | <td valign="top">The param will only passed if this property is set.</td>
|
---|
147 | <td align="center" valign="top">No</td>
|
---|
148 | </tr>
|
---|
149 | <tr>
|
---|
150 | <td valign="top">unless</td>
|
---|
151 | <td valign="top">The param will only passed unless this property is set.</td>
|
---|
152 | <td align="center" valign="top">No</td>
|
---|
153 | </tr>
|
---|
154 |
|
---|
155 | </table>
|
---|
156 | <h3>Example of report</h3>
|
---|
157 | <blockquote>
|
---|
158 | <pre><junitreport todir="./reports">
|
---|
159 | <fileset dir="./reports">
|
---|
160 | <include name="TEST-*.xml"/>
|
---|
161 | </fileset>
|
---|
162 | <report format="frames" todir="./report/html"/>
|
---|
163 | </junitreport>
|
---|
164 | </pre>
|
---|
165 | </blockquote>
|
---|
166 | <p>would generate a <tt>TESTS-TestSuites.xml</tt> file in the directory <tt>reports</tt> and
|
---|
167 | generate the default framed report in the directory <tt>report/html</tt>.</p>
|
---|
168 | <h3>Example of report with xsl params</h3>
|
---|
169 | <blockquote>
|
---|
170 | <pre>
|
---|
171 | <junitreport todir="${outputdir}">
|
---|
172 | <fileset dir="${jrdir}">
|
---|
173 | <include name="TEST-*.xml"/>
|
---|
174 | </fileset>
|
---|
175 | <report todir="${outputdir}/html"
|
---|
176 | styledir="junitreport"
|
---|
177 | format="frames">
|
---|
178 | <param name="key1" expression="value1"/>
|
---|
179 | <param name="key2" expression="value2"/>
|
---|
180 | </report>
|
---|
181 | </junitreport>
|
---|
182 | </pre>
|
---|
183 | </blockquote>
|
---|
184 | <p>This example requires a file called <tt>junitreport/junit-frames.xsl</tt>.
|
---|
185 | The XSL parameters key1 and key2 will be passed to the XSL transformation.</p>
|
---|
186 |
|
---|
187 | </body>
|
---|
188 |
|
---|
189 | </html>
|
---|