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