1 | <?xml version="1.0"?>
|
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
---|
3 | xmlns:lxslt="http://xml.apache.org/xslt"
|
---|
4 | xmlns:redirect="org.apache.xalan.lib.Redirect"
|
---|
5 | xmlns:string="xalan://java.lang.String"
|
---|
6 | extension-element-prefixes="redirect">
|
---|
7 | <xsl:output method="html" indent="yes" encoding="UTF-8"/>
|
---|
8 | <xsl:decimal-format decimal-separator="." grouping-separator=","/>
|
---|
9 | <!--
|
---|
10 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
11 | contributor license agreements. See the NOTICE file distributed with
|
---|
12 | this work for additional information regarding copyright ownership.
|
---|
13 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
14 | (the "License"); you may not use this file except in compliance with
|
---|
15 | the License. You may obtain a copy of the License at
|
---|
16 |
|
---|
17 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
18 |
|
---|
19 | Unless required by applicable law or agreed to in writing, software
|
---|
20 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
22 | See the License for the specific language governing permissions and
|
---|
23 | limitations under the License.
|
---|
24 | -->
|
---|
25 |
|
---|
26 | <!--
|
---|
27 |
|
---|
28 | Sample stylesheet to be used with Ant JUnitReport output.
|
---|
29 |
|
---|
30 | It creates a set of HTML files a la javadoc where you can browse easily
|
---|
31 | through all packages and classes.
|
---|
32 |
|
---|
33 | -->
|
---|
34 | <xsl:param name="output.dir" select="'.'"/>
|
---|
35 |
|
---|
36 |
|
---|
37 | <xsl:template match="testsuites">
|
---|
38 | <!-- create the index.html -->
|
---|
39 | <redirect:write file="{$output.dir}/index.html">
|
---|
40 | <xsl:call-template name="index.html"/>
|
---|
41 | </redirect:write>
|
---|
42 |
|
---|
43 | <!-- create the stylesheet.css -->
|
---|
44 | <redirect:write file="{$output.dir}/stylesheet.css">
|
---|
45 | <xsl:call-template name="stylesheet.css"/>
|
---|
46 | </redirect:write>
|
---|
47 |
|
---|
48 | <!-- create the overview-packages.html at the root -->
|
---|
49 | <redirect:write file="{$output.dir}/overview-summary.html">
|
---|
50 | <xsl:apply-templates select="." mode="overview.packages"/>
|
---|
51 | </redirect:write>
|
---|
52 |
|
---|
53 | <!-- create the all-packages.html at the root -->
|
---|
54 | <redirect:write file="{$output.dir}/overview-frame.html">
|
---|
55 | <xsl:apply-templates select="." mode="all.packages"/>
|
---|
56 | </redirect:write>
|
---|
57 |
|
---|
58 | <!-- create the all-classes.html at the root -->
|
---|
59 | <redirect:write file="{$output.dir}/allclasses-frame.html">
|
---|
60 | <xsl:apply-templates select="." mode="all.classes"/>
|
---|
61 | </redirect:write>
|
---|
62 |
|
---|
63 | <!-- process all packages -->
|
---|
64 | <xsl:for-each select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
|
---|
65 | <xsl:call-template name="package">
|
---|
66 | <xsl:with-param name="name" select="@package"/>
|
---|
67 | </xsl:call-template>
|
---|
68 | </xsl:for-each>
|
---|
69 | </xsl:template>
|
---|
70 |
|
---|
71 |
|
---|
72 | <xsl:template name="package">
|
---|
73 | <xsl:param name="name"/>
|
---|
74 | <xsl:variable name="package.dir">
|
---|
75 | <xsl:if test="not($name = '')"><xsl:value-of select="translate($name,'.','/')"/></xsl:if>
|
---|
76 | <xsl:if test="$name = ''">.</xsl:if>
|
---|
77 | </xsl:variable>
|
---|
78 | <!--Processing package <xsl:value-of select="@name"/> in <xsl:value-of select="$output.dir"/> -->
|
---|
79 | <!-- create a classes-list.html in the package directory -->
|
---|
80 | <redirect:write file="{$output.dir}/{$package.dir}/package-frame.html">
|
---|
81 | <xsl:call-template name="classes.list">
|
---|
82 | <xsl:with-param name="name" select="$name"/>
|
---|
83 | </xsl:call-template>
|
---|
84 | </redirect:write>
|
---|
85 |
|
---|
86 | <!-- create a package-summary.html in the package directory -->
|
---|
87 | <redirect:write file="{$output.dir}/{$package.dir}/package-summary.html">
|
---|
88 | <xsl:call-template name="package.summary">
|
---|
89 | <xsl:with-param name="name" select="$name"/>
|
---|
90 | </xsl:call-template>
|
---|
91 | </redirect:write>
|
---|
92 |
|
---|
93 | <!-- for each class, creates a @name.html -->
|
---|
94 | <!-- @bug there will be a problem with inner classes having the same name, it will be overwritten -->
|
---|
95 | <xsl:for-each select="/testsuites/testsuite[@package = $name]">
|
---|
96 | <redirect:write file="{$output.dir}/{$package.dir}/{@name}.html">
|
---|
97 | <xsl:apply-templates select="." mode="class.details"/>
|
---|
98 | </redirect:write>
|
---|
99 | <xsl:if test="string-length(./system-out)!=0">
|
---|
100 | <redirect:write file="{$output.dir}/{$package.dir}/{@name}-out.html">
|
---|
101 | <html>
|
---|
102 | <head>
|
---|
103 | <title>Standard Output from <xsl:value-of select="@name"/></title>
|
---|
104 | </head>
|
---|
105 | <body>
|
---|
106 | <pre><xsl:value-of select="./system-out"/></pre>
|
---|
107 | </body>
|
---|
108 | </html>
|
---|
109 | </redirect:write>
|
---|
110 | </xsl:if>
|
---|
111 | <xsl:if test="string-length(./system-err)!=0">
|
---|
112 | <redirect:write file="{$output.dir}/{$package.dir}/{@name}-err.html">
|
---|
113 | <html>
|
---|
114 | <head>
|
---|
115 | <title>Standard Error from <xsl:value-of select="@name"/></title>
|
---|
116 | </head>
|
---|
117 | <body>
|
---|
118 | <pre><xsl:value-of select="./system-err"/></pre>
|
---|
119 | </body>
|
---|
120 | </html>
|
---|
121 | </redirect:write>
|
---|
122 | </xsl:if>
|
---|
123 | </xsl:for-each>
|
---|
124 | </xsl:template>
|
---|
125 |
|
---|
126 | <xsl:template name="index.html">
|
---|
127 | <html>
|
---|
128 | <head>
|
---|
129 | <title>Unit Test Results.</title>
|
---|
130 | </head>
|
---|
131 | <frameset cols="20%,80%">
|
---|
132 | <frameset rows="30%,70%">
|
---|
133 | <frame src="overview-frame.html" name="packageListFrame"/>
|
---|
134 | <frame src="allclasses-frame.html" name="classListFrame"/>
|
---|
135 | </frameset>
|
---|
136 | <frame src="overview-summary.html" name="classFrame"/>
|
---|
137 | <noframes>
|
---|
138 | <h2>Frame Alert</h2>
|
---|
139 | <p>
|
---|
140 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
|
---|
141 | </p>
|
---|
142 | </noframes>
|
---|
143 | </frameset>
|
---|
144 | </html>
|
---|
145 | </xsl:template>
|
---|
146 |
|
---|
147 | <!-- this is the stylesheet css to use for nearly everything -->
|
---|
148 | <xsl:template name="stylesheet.css">
|
---|
149 | body {
|
---|
150 | font:normal 68% verdana,arial,helvetica;
|
---|
151 | color:#000000;
|
---|
152 | }
|
---|
153 | table tr td, table tr th {
|
---|
154 | font-size: 68%;
|
---|
155 | }
|
---|
156 | table.details tr th{
|
---|
157 | font-weight: bold;
|
---|
158 | text-align:left;
|
---|
159 | background:#a6caf0;
|
---|
160 | }
|
---|
161 | table.details tr td{
|
---|
162 | background:#eeeee0;
|
---|
163 | }
|
---|
164 |
|
---|
165 | p {
|
---|
166 | line-height:1.5em;
|
---|
167 | margin-top:0.5em; margin-bottom:1.0em;
|
---|
168 | }
|
---|
169 | h1 {
|
---|
170 | margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
|
---|
171 | }
|
---|
172 | h2 {
|
---|
173 | margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
|
---|
174 | }
|
---|
175 | h3 {
|
---|
176 | margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
|
---|
177 | }
|
---|
178 | h4 {
|
---|
179 | margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
---|
180 | }
|
---|
181 | h5 {
|
---|
182 | margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
---|
183 | }
|
---|
184 | h6 {
|
---|
185 | margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
---|
186 | }
|
---|
187 | .Error {
|
---|
188 | font-weight:bold; color:red;
|
---|
189 | }
|
---|
190 | .Failure {
|
---|
191 | font-weight:bold; color:purple;
|
---|
192 | }
|
---|
193 | .Properties {
|
---|
194 | text-align:right;
|
---|
195 | }
|
---|
196 | </xsl:template>
|
---|
197 |
|
---|
198 |
|
---|
199 | <!-- ======================================================================
|
---|
200 | This page is created for every testsuite class.
|
---|
201 | It prints a summary of the testsuite and detailed information about
|
---|
202 | testcase methods.
|
---|
203 | ====================================================================== -->
|
---|
204 | <xsl:template match="testsuite" mode="class.details">
|
---|
205 | <xsl:variable name="package.name" select="@package"/>
|
---|
206 | <xsl:variable name="class.name"><xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></xsl:variable>
|
---|
207 | <html>
|
---|
208 | <head>
|
---|
209 | <title>Unit Test Results: <xsl:value-of select="$class.name"/></title>
|
---|
210 | <xsl:call-template name="create.stylesheet.link">
|
---|
211 | <xsl:with-param name="package.name" select="$package.name"/>
|
---|
212 | </xsl:call-template>
|
---|
213 | <script type="text/javascript" language="JavaScript">
|
---|
214 | var TestCases = new Array();
|
---|
215 | var cur;
|
---|
216 | <xsl:apply-templates select="properties"/>
|
---|
217 | </script>
|
---|
218 | <script type="text/javascript" language="JavaScript"><![CDATA[
|
---|
219 | function displayProperties (name) {
|
---|
220 | var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
|
---|
221 | var doc = win.document;
|
---|
222 | doc.open();
|
---|
223 | doc.write("<html><head><title>Properties of " + name + "</title>");
|
---|
224 | doc.write("<style type=\"text/css\">");
|
---|
225 | doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }");
|
---|
226 | doc.write("table tr td, table tr th { font-size: 68%; }");
|
---|
227 | doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
|
---|
228 | doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
|
---|
229 | doc.write("table.properties td { font:normal; text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }");
|
---|
230 | doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }");
|
---|
231 | doc.write("</style>");
|
---|
232 | doc.write("</head><body>");
|
---|
233 | doc.write("<h3>Properties of " + name + "</h3>");
|
---|
234 | doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>");
|
---|
235 | doc.write("<table class='properties'>");
|
---|
236 | doc.write("<tr><th>Name</th><th>Value</th></tr>");
|
---|
237 | for (prop in TestCases[name]) {
|
---|
238 | doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>");
|
---|
239 | }
|
---|
240 | doc.write("</table>");
|
---|
241 | doc.write("</body></html>");
|
---|
242 | doc.close();
|
---|
243 | win.focus();
|
---|
244 | }
|
---|
245 | ]]>
|
---|
246 | </script>
|
---|
247 | </head>
|
---|
248 | <body>
|
---|
249 | <xsl:call-template name="pageHeader"/>
|
---|
250 | <h3>Class <xsl:value-of select="$class.name"/></h3>
|
---|
251 |
|
---|
252 |
|
---|
253 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
254 | <xsl:call-template name="testsuite.test.header"/>
|
---|
255 | <xsl:apply-templates select="." mode="print.test"/>
|
---|
256 | </table>
|
---|
257 |
|
---|
258 | <h2>Tests</h2>
|
---|
259 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
260 | <xsl:call-template name="testcase.test.header"/>
|
---|
261 | <!--
|
---|
262 | test can even not be started at all (failure to load the class)
|
---|
263 | so report the error directly
|
---|
264 | -->
|
---|
265 | <xsl:if test="./error">
|
---|
266 | <tr class="Error">
|
---|
267 | <td colspan="4"><xsl:apply-templates select="./error"/></td>
|
---|
268 | </tr>
|
---|
269 | </xsl:if>
|
---|
270 | <xsl:apply-templates select="./testcase" mode="print.test"/>
|
---|
271 | </table>
|
---|
272 | <div class="Properties">
|
---|
273 | <a>
|
---|
274 | <xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
|
---|
275 | Properties »
|
---|
276 | </a>
|
---|
277 | </div>
|
---|
278 | <xsl:if test="string-length(./system-out)!=0">
|
---|
279 | <div class="Properties">
|
---|
280 | <a>
|
---|
281 | <xsl:attribute name="href">./<xsl:value-of select="@name"/>-out.html</xsl:attribute>
|
---|
282 | System.out »
|
---|
283 | </a>
|
---|
284 | </div>
|
---|
285 | </xsl:if>
|
---|
286 | <xsl:if test="string-length(./system-err)!=0">
|
---|
287 | <div class="Properties">
|
---|
288 | <a>
|
---|
289 | <xsl:attribute name="href">./<xsl:value-of select="@name"/>-err.html</xsl:attribute>
|
---|
290 | System.err »
|
---|
291 | </a>
|
---|
292 | </div>
|
---|
293 | </xsl:if>
|
---|
294 | </body>
|
---|
295 | </html>
|
---|
296 | </xsl:template>
|
---|
297 |
|
---|
298 | <!--
|
---|
299 | Write properties into a JavaScript data structure.
|
---|
300 | This is based on the original idea by Erik Hatcher (ehatcher@apache.org)
|
---|
301 | -->
|
---|
302 | <xsl:template match="properties">
|
---|
303 | cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of select="../@name"/>'] = new Array();
|
---|
304 | <xsl:for-each select="property">
|
---|
305 | <xsl:sort select="@name"/>
|
---|
306 | cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>';
|
---|
307 | </xsl:for-each>
|
---|
308 | </xsl:template>
|
---|
309 |
|
---|
310 |
|
---|
311 | <!-- ======================================================================
|
---|
312 | This page is created for every package.
|
---|
313 | It prints the name of all classes that belongs to this package.
|
---|
314 | @param name the package name to print classes.
|
---|
315 | ====================================================================== -->
|
---|
316 | <!-- list of classes in a package -->
|
---|
317 | <xsl:template name="classes.list">
|
---|
318 | <xsl:param name="name"/>
|
---|
319 | <html>
|
---|
320 | <head>
|
---|
321 | <title>Unit Test Classes: <xsl:value-of select="$name"/></title>
|
---|
322 | <xsl:call-template name="create.stylesheet.link">
|
---|
323 | <xsl:with-param name="package.name" select="$name"/>
|
---|
324 | </xsl:call-template>
|
---|
325 | </head>
|
---|
326 | <body>
|
---|
327 | <table width="100%">
|
---|
328 | <tr>
|
---|
329 | <td nowrap="nowrap">
|
---|
330 | <h2><a href="package-summary.html" target="classFrame">
|
---|
331 | <xsl:value-of select="$name"/>
|
---|
332 | <xsl:if test="$name = ''"><none></xsl:if>
|
---|
333 | </a></h2>
|
---|
334 | </td>
|
---|
335 | </tr>
|
---|
336 | </table>
|
---|
337 |
|
---|
338 | <h2>Classes</h2>
|
---|
339 | <table width="100%">
|
---|
340 | <xsl:for-each select="/testsuites/testsuite[./@package = $name]">
|
---|
341 | <xsl:sort select="@name"/>
|
---|
342 | <tr>
|
---|
343 | <td nowrap="nowrap">
|
---|
344 | <a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
|
---|
345 | </td>
|
---|
346 | </tr>
|
---|
347 | </xsl:for-each>
|
---|
348 | </table>
|
---|
349 | </body>
|
---|
350 | </html>
|
---|
351 | </xsl:template>
|
---|
352 |
|
---|
353 |
|
---|
354 | <!--
|
---|
355 | Creates an all-classes.html file that contains a link to all package-summary.html
|
---|
356 | on each class.
|
---|
357 | -->
|
---|
358 | <xsl:template match="testsuites" mode="all.classes">
|
---|
359 | <html>
|
---|
360 | <head>
|
---|
361 | <title>All Unit Test Classes</title>
|
---|
362 | <xsl:call-template name="create.stylesheet.link">
|
---|
363 | <xsl:with-param name="package.name"/>
|
---|
364 | </xsl:call-template>
|
---|
365 | </head>
|
---|
366 | <body>
|
---|
367 | <h2>Classes</h2>
|
---|
368 | <table width="100%">
|
---|
369 | <xsl:apply-templates select="testsuite" mode="all.classes">
|
---|
370 | <xsl:sort select="@name"/>
|
---|
371 | </xsl:apply-templates>
|
---|
372 | </table>
|
---|
373 | </body>
|
---|
374 | </html>
|
---|
375 | </xsl:template>
|
---|
376 |
|
---|
377 | <xsl:template match="testsuite" mode="all.classes">
|
---|
378 | <xsl:variable name="package.name" select="@package"/>
|
---|
379 | <tr>
|
---|
380 | <td nowrap="nowrap">
|
---|
381 | <a target="classFrame">
|
---|
382 | <xsl:attribute name="href">
|
---|
383 | <xsl:if test="not($package.name='')">
|
---|
384 | <xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text>
|
---|
385 | </xsl:if><xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
|
---|
386 | </xsl:attribute>
|
---|
387 | <xsl:value-of select="@name"/>
|
---|
388 | </a>
|
---|
389 | </td>
|
---|
390 | </tr>
|
---|
391 | </xsl:template>
|
---|
392 |
|
---|
393 |
|
---|
394 | <!--
|
---|
395 | Creates an html file that contains a link to all package-summary.html files on
|
---|
396 | each package existing on testsuites.
|
---|
397 | @bug there will be a problem here, I don't know yet how to handle unnamed package :(
|
---|
398 | -->
|
---|
399 | <xsl:template match="testsuites" mode="all.packages">
|
---|
400 | <html>
|
---|
401 | <head>
|
---|
402 | <title>All Unit Test Packages</title>
|
---|
403 | <xsl:call-template name="create.stylesheet.link">
|
---|
404 | <xsl:with-param name="package.name"/>
|
---|
405 | </xsl:call-template>
|
---|
406 | </head>
|
---|
407 | <body>
|
---|
408 | <h2><a href="overview-summary.html" target="classFrame">Home</a></h2>
|
---|
409 | <h2>Packages</h2>
|
---|
410 | <table width="100%">
|
---|
411 | <xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
|
---|
412 | <xsl:sort select="@package"/>
|
---|
413 | </xsl:apply-templates>
|
---|
414 | </table>
|
---|
415 | </body>
|
---|
416 | </html>
|
---|
417 | </xsl:template>
|
---|
418 |
|
---|
419 | <xsl:template match="testsuite" mode="all.packages">
|
---|
420 | <tr>
|
---|
421 | <td nowrap="nowrap">
|
---|
422 | <a href="./{translate(@package,'.','/')}/package-summary.html" target="classFrame">
|
---|
423 | <xsl:value-of select="@package"/>
|
---|
424 | <xsl:if test="@package = ''"><none></xsl:if>
|
---|
425 | </a>
|
---|
426 | </td>
|
---|
427 | </tr>
|
---|
428 | </xsl:template>
|
---|
429 |
|
---|
430 |
|
---|
431 | <xsl:template match="testsuites" mode="overview.packages">
|
---|
432 | <html>
|
---|
433 | <head>
|
---|
434 | <title>Unit Test Results: Summary</title>
|
---|
435 | <xsl:call-template name="create.stylesheet.link">
|
---|
436 | <xsl:with-param name="package.name"/>
|
---|
437 | </xsl:call-template>
|
---|
438 | </head>
|
---|
439 | <body>
|
---|
440 | <xsl:attribute name="onload">open('allclasses-frame.html','classListFrame')</xsl:attribute>
|
---|
441 | <xsl:call-template name="pageHeader"/>
|
---|
442 | <h2>Summary</h2>
|
---|
443 | <xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
|
---|
444 | <xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
|
---|
445 | <xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
|
---|
446 | <xsl:variable name="skippedCount" select="sum(testsuite/@skipped)"/>
|
---|
447 | <xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
|
---|
448 | <xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
|
---|
449 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
450 | <tr valign="top">
|
---|
451 | <th>Tests</th>
|
---|
452 | <th>Failures</th>
|
---|
453 | <th>Errors</th>
|
---|
454 | <th>Skipped</th>
|
---|
455 | <th>Success rate</th>
|
---|
456 | <th>Time</th>
|
---|
457 | </tr>
|
---|
458 | <tr valign="top">
|
---|
459 | <xsl:attribute name="class">
|
---|
460 | <xsl:choose>
|
---|
461 | <xsl:when test="$errorCount > 0">Error</xsl:when>
|
---|
462 | <xsl:when test="$failureCount > 0">Failure</xsl:when>
|
---|
463 | <xsl:otherwise>Pass</xsl:otherwise>
|
---|
464 | </xsl:choose>
|
---|
465 | </xsl:attribute>
|
---|
466 | <td><xsl:value-of select="$testCount"/></td>
|
---|
467 | <td><xsl:value-of select="$failureCount"/></td>
|
---|
468 | <td><xsl:value-of select="$errorCount"/></td>
|
---|
469 | <td><xsl:value-of select="$skipCount" /></td>
|
---|
470 | <td>
|
---|
471 | <xsl:call-template name="display-percent">
|
---|
472 | <xsl:with-param name="value" select="$successRate"/>
|
---|
473 | </xsl:call-template>
|
---|
474 | </td>
|
---|
475 | <td>
|
---|
476 | <xsl:call-template name="display-time">
|
---|
477 | <xsl:with-param name="value" select="$timeCount"/>
|
---|
478 | </xsl:call-template>
|
---|
479 | </td>
|
---|
480 | </tr>
|
---|
481 | </table>
|
---|
482 | <table border="0" width="95%">
|
---|
483 | <tr>
|
---|
484 | <td style="text-align: justify;">
|
---|
485 | Note: <em>failures</em> are anticipated and checked for with assertions while <em>errors</em> are unanticipated.
|
---|
486 | </td>
|
---|
487 | </tr>
|
---|
488 | </table>
|
---|
489 |
|
---|
490 | <h2>Packages</h2>
|
---|
491 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
492 | <xsl:call-template name="testsuite.test.header"/>
|
---|
493 | <xsl:for-each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
|
---|
494 | <xsl:sort select="@package" order="ascending"/>
|
---|
495 | <!-- get the node set containing all testsuites that have the same package -->
|
---|
496 | <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/>
|
---|
497 | <tr valign="top">
|
---|
498 | <!-- display a failure if there is any failure/error in the package -->
|
---|
499 | <xsl:attribute name="class">
|
---|
500 | <xsl:choose>
|
---|
501 | <xsl:when test="sum($insamepackage/@errors) > 0">Error</xsl:when>
|
---|
502 | <xsl:when test="sum($insamepackage/@failures) > 0">Failure</xsl:when>
|
---|
503 | <xsl:otherwise>Pass</xsl:otherwise>
|
---|
504 | </xsl:choose>
|
---|
505 | </xsl:attribute>
|
---|
506 | <td><a href="./{translate(@package,'.','/')}/package-summary.html">
|
---|
507 | <xsl:value-of select="@package"/>
|
---|
508 | <xsl:if test="@package = ''"><none></xsl:if>
|
---|
509 | </a></td>
|
---|
510 | <td><xsl:value-of select="sum($insamepackage/@tests)"/></td>
|
---|
511 | <td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
|
---|
512 | <td><xsl:value-of select="sum($insamepackage/@failures)"/></td>
|
---|
513 | <td><xsl:value-of select="sum($insamepackage/@skipped)" /></td>
|
---|
514 | <td>
|
---|
515 | <xsl:call-template name="display-time">
|
---|
516 | <xsl:with-param name="value" select="sum($insamepackage/@time)"/>
|
---|
517 | </xsl:call-template>
|
---|
518 | </td>
|
---|
519 | <td><xsl:value-of select="$insamepackage/@timestamp"/></td>
|
---|
520 | <td><xsl:value-of select="$insamepackage/@hostname"/></td>
|
---|
521 | </tr>
|
---|
522 | </xsl:for-each>
|
---|
523 | </table>
|
---|
524 | </body>
|
---|
525 | </html>
|
---|
526 | </xsl:template>
|
---|
527 |
|
---|
528 |
|
---|
529 | <xsl:template name="package.summary">
|
---|
530 | <xsl:param name="name"/>
|
---|
531 | <html>
|
---|
532 | <head>
|
---|
533 | <xsl:call-template name="create.stylesheet.link">
|
---|
534 | <xsl:with-param name="package.name" select="$name"/>
|
---|
535 | </xsl:call-template>
|
---|
536 | </head>
|
---|
537 | <body>
|
---|
538 | <xsl:attribute name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
|
---|
539 | <xsl:call-template name="pageHeader"/>
|
---|
540 | <h3>Package <xsl:value-of select="$name"/></h3>
|
---|
541 |
|
---|
542 | <!--table border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
543 | <xsl:call-template name="class.metrics.header"/>
|
---|
544 | <xsl:apply-templates select="." mode="print.metrics"/>
|
---|
545 | </table-->
|
---|
546 |
|
---|
547 | <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = $name]"/>
|
---|
548 | <xsl:if test="count($insamepackage) > 0">
|
---|
549 | <h2>Classes</h2>
|
---|
550 | <p>
|
---|
551 | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
|
---|
552 | <xsl:call-template name="testsuite.test.header"/>
|
---|
553 | <xsl:apply-templates select="$insamepackage" mode="print.test">
|
---|
554 | <xsl:sort select="@name"/>
|
---|
555 | </xsl:apply-templates>
|
---|
556 | </table>
|
---|
557 | </p>
|
---|
558 | </xsl:if>
|
---|
559 | </body>
|
---|
560 | </html>
|
---|
561 | </xsl:template>
|
---|
562 |
|
---|
563 |
|
---|
564 | <!--
|
---|
565 | transform string like a.b.c to ../../../
|
---|
566 | @param path the path to transform into a descending directory path
|
---|
567 | -->
|
---|
568 | <xsl:template name="path">
|
---|
569 | <xsl:param name="path"/>
|
---|
570 | <xsl:if test="contains($path,'.')">
|
---|
571 | <xsl:text>../</xsl:text>
|
---|
572 | <xsl:call-template name="path">
|
---|
573 | <xsl:with-param name="path"><xsl:value-of select="substring-after($path,'.')"/></xsl:with-param>
|
---|
574 | </xsl:call-template>
|
---|
575 | </xsl:if>
|
---|
576 | <xsl:if test="not(contains($path,'.')) and not($path = '')">
|
---|
577 | <xsl:text>../</xsl:text>
|
---|
578 | </xsl:if>
|
---|
579 | </xsl:template>
|
---|
580 |
|
---|
581 |
|
---|
582 | <!-- create the link to the stylesheet based on the package name -->
|
---|
583 | <xsl:template name="create.stylesheet.link">
|
---|
584 | <xsl:param name="package.name"/>
|
---|
585 | <link rel="stylesheet" type="text/css" title="Style"><xsl:attribute name="href"><xsl:if test="not($package.name = 'unnamed package')"><xsl:call-template name="path"><xsl:with-param name="path" select="$package.name"/></xsl:call-template></xsl:if>stylesheet.css</xsl:attribute></link>
|
---|
586 | </xsl:template>
|
---|
587 |
|
---|
588 |
|
---|
589 | <!-- Page HEADER -->
|
---|
590 | <xsl:template name="pageHeader">
|
---|
591 | <h1>Unit Test Results</h1>
|
---|
592 | <table width="100%">
|
---|
593 | <tr>
|
---|
594 | <td align="left"></td>
|
---|
595 | <td align="right">Designed for use with <a href="http://www.junit.org/">JUnit</a> and <a href="http://ant.apache.org/">Ant</a>.</td>
|
---|
596 | </tr>
|
---|
597 | </table>
|
---|
598 | <hr size="1"/>
|
---|
599 | </xsl:template>
|
---|
600 |
|
---|
601 | <!-- class header -->
|
---|
602 | <xsl:template name="testsuite.test.header">
|
---|
603 | <tr valign="top">
|
---|
604 | <th width="80%">Name</th>
|
---|
605 | <th>Tests</th>
|
---|
606 | <th>Errors</th>
|
---|
607 | <th>Failures</th>
|
---|
608 | <th>Skipped</th>
|
---|
609 | <th nowrap="nowrap">Time(s)</th>
|
---|
610 | <th nowrap="nowrap">Time Stamp</th>
|
---|
611 | <th>Host</th>
|
---|
612 | </tr>
|
---|
613 | </xsl:template>
|
---|
614 |
|
---|
615 | <!-- method header -->
|
---|
616 | <xsl:template name="testcase.test.header">
|
---|
617 | <tr valign="top">
|
---|
618 | <th>Name</th>
|
---|
619 | <th>Status</th>
|
---|
620 | <th width="80%">Type</th>
|
---|
621 | <th nowrap="nowrap">Time(s)</th>
|
---|
622 | </tr>
|
---|
623 | </xsl:template>
|
---|
624 |
|
---|
625 |
|
---|
626 | <!-- class information -->
|
---|
627 | <xsl:template match="testsuite" mode="print.test">
|
---|
628 | <tr valign="top">
|
---|
629 | <xsl:attribute name="class">
|
---|
630 | <xsl:choose>
|
---|
631 | <xsl:when test="@errors[.> 0]">Error</xsl:when>
|
---|
632 | <xsl:when test="@failures[.> 0]">Failure</xsl:when>
|
---|
633 | <xsl:otherwise>Pass</xsl:otherwise>
|
---|
634 | </xsl:choose>
|
---|
635 | </xsl:attribute>
|
---|
636 | <td><a href="{@name}.html"><xsl:value-of select="@name"/></a></td>
|
---|
637 | <td><xsl:apply-templates select="@tests"/></td>
|
---|
638 | <td><xsl:apply-templates select="@errors"/></td>
|
---|
639 | <td><xsl:apply-templates select="@failures"/></td>
|
---|
640 | <td><xsl:apply-templates select="@skipped" /></td>
|
---|
641 | <td><xsl:call-template name="display-time">
|
---|
642 | <xsl:with-param name="value" select="@time"/>
|
---|
643 | </xsl:call-template>
|
---|
644 | </td>
|
---|
645 | <td><xsl:apply-templates select="@timestamp"/></td>
|
---|
646 | <td><xsl:apply-templates select="@hostname"/></td>
|
---|
647 | </tr>
|
---|
648 | </xsl:template>
|
---|
649 |
|
---|
650 | <xsl:template match="testcase" mode="print.test">
|
---|
651 | <tr valign="top">
|
---|
652 | <xsl:attribute name="class">
|
---|
653 | <xsl:choose>
|
---|
654 | <xsl:when test="error">Error</xsl:when>
|
---|
655 | <xsl:when test="failure">Failure</xsl:when>
|
---|
656 | <xsl:otherwise>TableRowColor</xsl:otherwise>
|
---|
657 | </xsl:choose>
|
---|
658 | </xsl:attribute>
|
---|
659 | <td><xsl:value-of select="@name"/></td>
|
---|
660 | <xsl:choose>
|
---|
661 | <xsl:when test="failure">
|
---|
662 | <td>Failure</td>
|
---|
663 | <td><xsl:apply-templates select="failure"/></td>
|
---|
664 | </xsl:when>
|
---|
665 | <xsl:when test="error">
|
---|
666 | <td>Error</td>
|
---|
667 | <td><xsl:apply-templates select="error"/></td>
|
---|
668 | </xsl:when>
|
---|
669 | <xsl:when test="skipped">
|
---|
670 | <td>Skipped</td>
|
---|
671 | <td><xsl:apply-templates select="skipped"/></td>
|
---|
672 | </xsl:when>
|
---|
673 | <xsl:otherwise>
|
---|
674 | <td>Success</td>
|
---|
675 | <td></td>
|
---|
676 | </xsl:otherwise>
|
---|
677 | </xsl:choose>
|
---|
678 | <td>
|
---|
679 | <xsl:call-template name="display-time">
|
---|
680 | <xsl:with-param name="value" select="@time"/>
|
---|
681 | </xsl:call-template>
|
---|
682 | </td>
|
---|
683 | </tr>
|
---|
684 | </xsl:template>
|
---|
685 |
|
---|
686 |
|
---|
687 | <!-- Note : the below template error and failure are the same style
|
---|
688 | so just call the same style store in the toolkit template -->
|
---|
689 | <xsl:template match="failure">
|
---|
690 | <xsl:call-template name="display-failures"/>
|
---|
691 | </xsl:template>
|
---|
692 |
|
---|
693 | <xsl:template match="error">
|
---|
694 | <xsl:call-template name="display-failures"/>
|
---|
695 | </xsl:template>
|
---|
696 |
|
---|
697 | <!-- Style for the error and failure in the testcase template -->
|
---|
698 | <xsl:template name="display-failures">
|
---|
699 | <xsl:choose>
|
---|
700 | <xsl:when test="not(@message)">N/A</xsl:when>
|
---|
701 | <xsl:otherwise>
|
---|
702 | <xsl:value-of select="@message"/>
|
---|
703 | </xsl:otherwise>
|
---|
704 | </xsl:choose>
|
---|
705 | <!-- display the stacktrace -->
|
---|
706 | <br/><br/>
|
---|
707 | <code>
|
---|
708 | <xsl:call-template name="br-replace">
|
---|
709 | <xsl:with-param name="word" select="."/>
|
---|
710 | </xsl:call-template>
|
---|
711 | </code>
|
---|
712 | <!-- the latter is better but might be problematic for non-21" monitors... -->
|
---|
713 | <!--pre><xsl:value-of select="."/></pre-->
|
---|
714 | </xsl:template>
|
---|
715 |
|
---|
716 | <xsl:template name="JS-escape">
|
---|
717 | <xsl:param name="string"/>
|
---|
718 | <xsl:param name="tmp1" select="string:replaceAll(string:new(string($string)),'\\','\\\\')"/>
|
---|
719 | <xsl:param name="tmp2" select="string:replaceAll(string:new(string($tmp1)),"'","\\'")"/>
|
---|
720 | <xsl:param name="tmp3" select="string:replaceAll(string:new(string($tmp2))," ",'\\n')"/>
|
---|
721 | <xsl:param name="tmp4" select="string:replaceAll(string:new(string($tmp3))," ",'\\r')"/>
|
---|
722 | <xsl:value-of select="$tmp4"/>
|
---|
723 | </xsl:template>
|
---|
724 |
|
---|
725 |
|
---|
726 | <!--
|
---|
727 | template that will convert a carriage return into a br tag
|
---|
728 | @param word the text from which to convert CR to BR tag
|
---|
729 | -->
|
---|
730 | <xsl:template name="br-replace">
|
---|
731 | <xsl:param name="word"/>
|
---|
732 | <xsl:param name="br"><br/></xsl:param>
|
---|
733 | <xsl:value-of select='stringutils:replace(string($word),"
",$br)'/>
|
---|
734 | </xsl:template>
|
---|
735 |
|
---|
736 | <xsl:template name="display-time">
|
---|
737 | <xsl:param name="value"/>
|
---|
738 | <xsl:value-of select="format-number($value,'0.000')"/>
|
---|
739 | </xsl:template>
|
---|
740 |
|
---|
741 | <xsl:template name="display-percent">
|
---|
742 | <xsl:param name="value"/>
|
---|
743 | <xsl:value-of select="format-number($value,'0.00%')"/>
|
---|
744 | </xsl:template>
|
---|
745 | </xsl:stylesheet>
|
---|