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