You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

junitreport.html 6.7 KiB

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