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