10139N/A extension-
element-
prefixes="redirect">
10139N/A<
xsl:
output method="html" indent="yes" encoding="UTF-8"/>
17185N/A<
xsl:
decimal-
format decimal-
separator="." grouping-
separator=","/>
10139N/A Licensed to the Apache Software Foundation (ASF) under one or more 17178N/A contributor license agreements. See the NOTICE file distributed with 17178N/A this work for additional information regarding copyright ownership. 10139N/A The ASF licenses this file to You under the Apache License, Version 2.0 10139N/A (the "License"); you may not use this file except in compliance with 10139N/A the License. You may obtain a copy of the License at 10139N/A Unless required by applicable law or agreed to in writing, software 10139N/A distributed under the License is distributed on an "AS IS" BASIS, 10139N/A WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17394N/A See the License for the specific language governing permissions and 14434N/A Sample stylesheet to be used with Ant JUnitReport output. 14434N/A It creates a set of HTML files a la javadoc where you can browse easily 15440N/A through all packages and classes. 10139N/A<
xsl:
template match="testsuites">
15864N/A <
xsl:
for-
each select="/testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
10139N/A <
xsl:
call-
template name="package">
10139N/A <
xsl:
with-
param name="name" select="@package"/>
10139N/A <
xsl:
if test="not($name = '')"><
xsl:
value-
of select="translate($name,'.','/')"/></
xsl:
if>
10139N/A <
xsl:
if test="$name = ''">.</
xsl:
if>
10139N/A <!--Processing package <xsl:value-of select="@name"/> in <xsl:value-of select="$output.dir"/> --> 10139N/A <
xsl:
with-
param name="name" select="$name"/>
10139N/A <
xsl:
with-
param name="name" select="$name"/>
10139N/A <!-- @bug there will be a problem with inner classes having the same name, it will be overwritten --> 10139N/A <
title>Standard Output from <
xsl:
value-
of select="@name"/></
title>
10139N/A <
title>Standard Error from <
xsl:
value-
of select="@name"/></
title>
10139N/A <
title>Unit Test Results.</
title>
10139N/A 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.
12886N/A<!-- this is the stylesheet css to use for nearly everything --> 15740N/A font:normal 68% verdana,arial,helvetica;
10139N/A margin-top:0.5em; margin-bottom:1.0em;
10139N/A margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
10139N/A margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
10139N/A margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
10139N/A margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
10139N/A margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
10139N/A margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
16174N/A font-weight:bold; color:purple;
10139N/A<!-- ====================================================================== 10139N/A This page is created for every testsuite class. 15734N/A It prints a summary of the testsuite and detailed information about 10139N/A ====================================================================== --> 10139N/A <
xsl:
apply-
templates select="properties"/>
10139N/A function displayProperties (name) { 10139N/A doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }"); 10139N/A doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }"); 10139N/A for (prop in TestCases[name]) { 10139N/A doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>"); 10139N/A <
xsl:
call-
template name="pageHeader"/>
10139N/A <
table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
17108N/A <
table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
16852N/A test can even not be started at all (failure to load the class) 16484N/A <
td colspan="4"><
xsl:
apply-
templates select="/error"/></
td>
15862N/A <
xsl:
attribute name="href">javascript:displayProperties('<
xsl:
value-
of select="@package"/>.<
xsl:
value-
of select="@name"/>');</
xsl:
attribute>
15448N/A <
xsl:
attribute name="href">./<
xsl:
value-
of select="@name"/>
-out.html</
xsl:
attribute>
14497N/A <
xsl:
attribute name="href">./<
xsl:
value-
of select="@name"/>
-err.html</
xsl:
attribute>
13502N/A Write properties into a JavaScript data structure. 13502N/A This is based on the original idea by Erik Hatcher (ehatcher@apache.org) 13424N/A <
xsl:
template match="properties">
13329N/A cur = TestCases['<
xsl:
value-
of select="../@package"/>.<
xsl:
value-
of select="../@name"/>'] = new Array();
13329N/A <
xsl:
for-
each select="property">
13329N/A cur['<
xsl:
value-
of select="@name"/>'] = '<
xsl:
call-
template name="JS-escape"><
xsl:
with-
param name="string" select="@value"/></
xsl:
call-
template>';
12998N/A<!-- ====================================================================== 12987N/A This page is created for every package. 12998N/A It prints the name of all classes that belongs to this package. 12825N/A @param name the package name to print classes. 12825N/A ====================================================================== --> 12775N/A<!-- list of classes in a package --> 12629N/A <
title>Unit Test Classes: <
xsl:
value-
of select="$name"/></
title>
12246N/A <
xsl:
if test="$name = ''"><none></
xsl:
if>
12127N/A <
a href="{@name}.html" target="classFrame"><
xsl:
value-
of select="@name"/></
a>
11419N/A <
title>All Unit Test Classes</
title>
10176N/A </
xsl:
if><
xsl:
value-
of select="@name"/><
xsl:
text>.html</
xsl:
text>
10139N/A each package existing on testsuites. 10139N/A @bug there will be a problem here, I don't know yet how to handle unnamed package :( 10139N/A <
title>All Unit Test Packages</
title>
10139N/A <
xsl:
apply-
templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
10139N/A <
xsl:
value-
of select="@package"/>
10139N/A <
xsl:
if test="@package = ''"><none></
xsl:
if>
10139N/A <
title>Unit Test Results: Summary</
title>
10139N/A <
xsl:
call-
template name="pageHeader"/>
10139N/A <
xsl:
variable name="testCount" select="sum(testsuite/@tests)"/>
10139N/A <
xsl:
variable name="errorCount" select="sum(testsuite/@errors)"/>
10139N/A <
xsl:
variable name="failureCount" select="sum(testsuite/@failures)"/>
10139N/A <
xsl:
variable name="timeCount" select="sum(testsuite/@time)"/>
10139N/A <
xsl:
variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
10139N/A <
table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
10139N/A <
xsl:
when test="$errorCount > 0">Error</
xsl:
when>
10139N/A <
xsl:
when test="$failureCount > 0">Failure</
xsl:
when>
10139N/A <
xsl:
otherwise>Pass</
xsl:
otherwise>
10139N/A <
td><
xsl:
value-
of select="$testCount"/></
td>
10139N/A <
td><
xsl:
value-
of select="$failureCount"/></
td>
10139N/A <
td><
xsl:
value-
of select="$errorCount"/></
td>
10139N/A <
xsl:
call-
template name="display-percent">
10139N/A <
xsl:
with-
param name="value" select="$successRate"/>
10139N/A <
xsl:
call-
template name="display-time">
10139N/A <
xsl:
with-
param name="value" select="$timeCount"/>
10139N/A <
td style="text-align: justify;">
10139N/A Note: <
em>failures</
em> are anticipated and checked for with assertions while <
em>errors</
em> are unanticipated.
10139N/A <
table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
10139N/A <
xsl:
for-
each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
10139N/A <
xsl:
sort select="@package" order="ascending"/>
10139N/A <!-- get the node set containing all testsuites that have the same package --> 10139N/A <
xsl:
when test="sum($insamepackage/@errors) > 0">Error</
xsl:
when>
10139N/A <
xsl:
when test="sum($insamepackage/@failures) > 0">Failure</
xsl:
when>
10139N/A <
xsl:
otherwise>Pass</
xsl:
otherwise>
10139N/A <
xsl:
value-
of select="@package"/>
10139N/A <
xsl:
if test="@package = ''"><none></
xsl:
if>
10139N/A <
td><
xsl:
value-
of select="sum($insamepackage/@tests)"/></
td>
10139N/A <
td><
xsl:
value-
of select="sum($insamepackage/@errors)"/></
td>
10139N/A <
td><
xsl:
value-
of select="sum($insamepackage/@failures)"/></
td>
10139N/A <
xsl:
call-
template name="display-time">
10139N/A <
xsl:
with-
param name="value" select="sum($insamepackage/@time)"/>
10139N/A <
td><
xsl:
value-
of select="$insamepackage/@timestamp"/></
td>
10139N/A <
td><
xsl:
value-
of select="$insamepackage/@hostname"/></
td>
10139N/A <
xsl:
call-
template name="pageHeader"/>
10139N/A <
h3>Package <
xsl:
value-
of select="$name"/></
h3>
10139N/A <!--table border="0" cellpadding="5" cellspacing="2" width="95%"> 10139N/A <
xsl:
if test="count($insamepackage) > 0">
10139N/A <
table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
10139N/A @param path the path to transform into a descending directory path 10139N/A <
xsl:
if test="contains($path,'.')">
10139N/A <
xsl:
call-
template name="path">
10139N/A <
xsl:
with-
param name="path"><
xsl:
value-
of select="substring-after($path,'.')"/></
xsl:
with-
param>
10139N/A <
xsl:
if test="not(contains($path,'.')) and not($path = '')">
10139N/A<!-- create the link to the stylesheet based on the package name --> 10139N/A <
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>
10139N/A<
xsl:
template name="pageHeader">
10139N/A <
th nowrap="nowrap">Time(s)</
th>
10139N/A <
th nowrap="nowrap">Time Stamp</
th>
10139N/A <
th nowrap="nowrap">Time(s)</
th>
10139N/A <
xsl:
when test="@errors[.> 0]">Error</
xsl:
when>
10139N/A <
xsl:
when test="@failures[.> 0]">Failure</
xsl:
when>
10139N/A <
xsl:
otherwise>Pass</
xsl:
otherwise>
10139N/A <
td><
a href="{@name}.html"><
xsl:
value-
of select="@name"/></
a></
td>
10139N/A <
td><
xsl:
apply-
templates select="@tests"/></
td>
10139N/A <
td><
xsl:
apply-
templates select="@errors"/></
td>
10139N/A <
td><
xsl:
apply-
templates select="@failures"/></
td>
10139N/A <
td><
xsl:
call-
template name="display-time">
10139N/A <
xsl:
with-
param name="value" select="@time"/>
10139N/A <
td><
xsl:
apply-
templates select="@timestamp"/></
td>
10139N/A <
td><
xsl:
apply-
templates select="@hostname"/></
td>
10139N/A <
xsl:
when test="error">Error</
xsl:
when>
10139N/A <
xsl:
when test="failure">Failure</
xsl:
when>
10139N/A <
xsl:
otherwise>TableRowColor</
xsl:
otherwise>
10139N/A <
td><
xsl:
value-
of select="@name"/></
td>
10139N/A <
td><
xsl:
apply-
templates select="failure"/></
td>
10139N/A <
td><
xsl:
apply-
templates select="error"/></
td>
10139N/A <
xsl:
call-
template name="display-time">
10139N/A <
xsl:
with-
param name="value" select="@time"/>
10139N/A<!-- Note : the below template error and failure are the same style 10139N/A so just call the same style store in the toolkit template --> 10139N/A <
xsl:
call-
template name="display-failures"/>
10139N/A <
xsl:
call-
template name="display-failures"/>
10139N/A<!-- Style for the error and failure in the testcase template --> 10139N/A<
xsl:
template name="display-failures">
10139N/A <
xsl:
when test="not(@message)">N/A</
xsl:
when>
10139N/A <
xsl:
value-
of select="@message"/>
10139N/A <!-- display the stacktrace --> 10139N/A <
xsl:
call-
template name="br-replace">
10139N/A <
xsl:
with-
param name="word" select="."/>
10139N/A <!-- the latter is better but might be problematic for non-21" monitors... --> 10139N/A <!--pre><xsl:value-of select="."/></pre--> 10139N/A <
xsl:
param name="tmp1" select="stringutils:replace(string($string),'\','\\')"/>
10139N/A <
xsl:
param name="tmp2" select="stringutils:replace(string($tmp1),"'","\'")"/>
10139N/A template that will convert a carriage return into a br tag 10139N/A @param word the text from which to convert CR to BR tag 10139N/A<
xsl:
template name="br-replace">
10139N/A <
xsl:
param name="br"><
br/></
xsl:
param>
10139N/A <
xsl:
value-
of select='stringutils:replace(string($word),"
",$br)'/>
10139N/A<
xsl:
template name="display-time">
10139N/A <
xsl:
value-
of select="format-number($value,'0.000')"/>
10139N/A<
xsl:
template name="display-percent">
10139N/A <
xsl:
value-
of select="format-number($value,'0.00%')"/>