source: release-kits/lirk3/bin/ant-installer/web/manual1.7.0/manual/OptionalTasks/junitreport.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 7.4 KB
Line 
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>
26Merge the individual XML files generated by the JUnit task and eventually apply
27a stylesheet on the resulting merged document to provide a browsable report of
28the testcases results.
29<p><strong>Note:</strong> This task depends on external libraries not included in
30the Ant distribution. See <a href="../install.html#librarydependencies">
31Library Dependencies</a> for more information.</p>
32
33<h3>Requirements</h3>
34
35<p>The task needs Apache <a
36href="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
38version of XSLTC). Starting from JDK 1.4.2-01 it ships with a bundled
39Xalan-J 2.4.1+, meaning that JDK version prior to 1.4.2-01 won't work
40out 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-
51and Xalan 2.4.1+/XSLTC, since there was no way to support both couples at the same
52time.</p>
53<p>With Ant 1.7 we had to drop support Xalan-J 1, since Xalan-J 1 has not
54available 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
79task using the nested <a href="../CoreTypes/fileset.html"><code>&lt;FileSet&gt;</code></a>
80element.</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 &quot;noframes&quot;
93 or &quot;frames&quot;.</td>
94 <td align="center" valign="top">No, default to &quot;frames&quot;</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
116a 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
119file 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.
125These 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>&lt;junitreport todir=&quot;./reports&quot;&gt;
159 &lt;fileset dir=&quot;./reports&quot;&gt;
160 &lt;include name=&quot;TEST-*.xml&quot;/&gt;
161 &lt;/fileset&gt;
162 &lt;report format=&quot;frames&quot; todir=&quot;./report/html&quot;/&gt;
163&lt;/junitreport&gt;
164</pre>
165</blockquote>
166<p>would generate a <tt>TESTS-TestSuites.xml</tt> file in the directory <tt>reports</tt> and
167generate 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&lt;junitreport todir="${outputdir}"&gt;
172 &lt;fileset dir="${jrdir}"&gt;
173 &lt;include name="TEST-*.xml"/&gt;
174 &lt;/fileset&gt;
175 &lt;report todir="${outputdir}/html"
176 styledir="junitreport"
177 format="frames"&gt;
178 &lt;param name="key1" expression="value1"/&gt;
179 &lt;param name="key2" expression="value2"/&gt;
180 &lt;/report&gt;
181&lt;/junitreport&gt;
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>
Note: See TracBrowser for help on using the repository browser.