@@ -6,7 +6,7 @@
<!-- ======================================================================
Stylesheet to transform an XML file generated by the Ant MAud it task into
Stylesheet to transform an XML file generated by the Ant JUn it task into
a set of JavaDoc-like HTML page to make pages more convenient to be browsed.
It use the Xalan redirect extension to write to multiple output files.
@@ -14,8 +14,8 @@
Note: HTML output can be made much more clean by removing non css attributes
====================================================================== -->
<xsl:output method="html" indent="yes"/>
<xsl:decimal-format decimal-separator="." grouping-separator="," />
<xsl:output method="html" indent="yes"/>
<xsl:decimal-format decimal-separator="." grouping-separator=","/>
<!--
Xalan redirect extension writes relative file based on the parent directory
@@ -27,7 +27,7 @@
This has to be invoked as follows from the command line:
java -classpath bsf.jar;xalan.jar;xerces.jar org.apache.xalan.xslt.Process -IN testsuites.xml -XSL maudit .xsl -PARAM output.dir './report'
java -classpath bsf.jar;xalan.jar;xerces.jar org.apache.xalan.xslt.Process -IN testsuites.xml -XSL junit-frames .xsl -PARAM output.dir './report'
-->
<xsl:param name="output.dir" select="'.'"/>
@@ -98,61 +98,72 @@
</xsl:template>
<xsl:template name="index.html">
<HTML>
<HEAD><TITLE>Unit Test Results.</TITLE></HEAD>
<FRAMESET cols="20%,80%">
<FRAMESET rows="30%,70%">
<FRAME src="overview-frame.html" name="packageListFrame"/>
<FRAME src="allclasses-frame.html" name="classListFrame"/>
</FRAMESET>
<FRAME src="overview-summary.html" name="classFrame"/>
</FRAMESET>
<html>
<head>
<title>Unit Test Results.</title>
</head>
<frameset cols="20%,80%">
<frameset rows="30%,70%">
<frame src="overview-frame.html" name="packageListFrame"/>
<frame src="allclasses-frame.html" name="classListFrame"/>
</frameset>
<frame src="overview-summary.html" name="classFrame"/>
</frameset>
<noframes>
<H2>Frame Alert</H2>
<P >
<h2>Frame Alert</h 2>
<p >
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.
</P >
</p >
</noframes>
</HTML >
</html >
</xsl:template>
<!-- this is the stylesheet css to use for nearly everything -->
<xsl:template name="stylesheet.css">
BODY {
body {
font:normal 68% verdana,arial,helvetica;
color:#000000;
}
TD {
FONT-SIZE : 68%
td {
font-size : 68%
}
P {
p {
line-height:1.5em;
margin-top:0.5em; margin-bottom:1.0em;
}
H1 {
MARGIN: 0px 0px 5px; FONT: 165% verdana,arial,helvetica
h1 {
margin: 0px 0px 5px;
font: 165% verdana,arial,helvetica
}
H2 {
MARGIN-TOP: 1em; MARGIN-BOTTOM: 0.5em; FONT: bold 125% verdana,arial,helvetica
h2 {
margin-top: 1em;
margin-bottom: 0.5em;
font: bold 125% verdana,arial,helvetica
}
H3 {
MARGIN-BOTTOM: 0.5em; FONT: bold 115% verdana,arial,helvetica
h3 {
margin-bottom: 0.5em;
font: bold 115% verdana,arial,helvetica
}
H4 {
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
h4 {
margin-bottom: 0.5em;
font: bold 100% verdana,arial,helvetica
}
H5 {
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
h5 {
margin-bottom: 0.5em;
font: bold 100% verdana,arial,helvetica
}
H6 {
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica
h6 {
margin-bottom: 0.5em;
font: bold 100% verdana,arial,helvetica
}
.Error {
font-weight:bold; color:red;
font-weight:bold;
color:red;
}
.Failure {
font-weight:bold; color:purple;
font-weight:bold;
color:purple;
}
</xsl:template>
@@ -165,15 +176,15 @@ H6 {
====================================================================== -->
<xsl:template match="testsuite" mode="class.details">
<xsl:variable name="package.name" select="@package"/>
<HTML >
<HEAD >
<html >
<head >
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$package.name"/>
</xsl:call-template>
</HEAD >
<BODY >
</head >
<body >
<xsl:call-template name="pageHeader"/>
<H 3>Class <xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></H 3>
<h 3>Class <xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></h 3>
<table border="0" cellpadding="5" cellspacing="2" width="95%">
@@ -181,7 +192,7 @@ H6 {
<xsl:apply-templates select="." mode="print.test"/>
</table>
<H2>Tests</H 2>
<h2>Tests</h 2>
<p>
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<xsl:call-template name="testcase.test.header"/>
@@ -189,8 +200,8 @@ H6 {
</table>
</p>
</BODY >
</HTML >
</body >
</html >
</xsl:template>
@@ -202,24 +213,24 @@ H6 {
<!-- list of classes in a package -->
<xsl:template name="classes.list">
<xsl:param name="name"/>
<HTML >
<HEAD >
<html >
<head >
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$name"/>
</xsl:call-template>
</HEAD >
<BODY >
</head >
<body >
<table width="100%">
<tr>
<td nowrap="nowrap">
<H2><a href="package-summary.html" target="classFrame"><xsl:value-of select="$name"/></a></H 2>
<h2><a href="package-summary.html" target="classFrame"><xsl:value-of select="$name"/></a></h 2>
</td>
</tr>
</table>
<H2>Classes</H 2>
<h2>Classes</h 2>
<p>
<TABLE WIDTH ="100%">
<table width ="100%">
<xsl:for-each select="/testsuites/testsuite[./@package = $name]">
<xsl:sort select="@name"/>
<tr>
@@ -228,10 +239,10 @@ H6 {
</td>
</tr>
</xsl:for-each>
</TABLE >
</table >
</p>
</BODY >
</HTML >
</body >
</html >
</xsl:template>
@@ -260,8 +271,8 @@ H6 {
</xsl:template>
<xsl:template match="testsuite" mode="all.classes">
<!-- (ancestor::package)[last()] is buggy in MSXML3, fixed in SP1 ? -->
<xsl:variable name="package.name" select="@package"/>
<!-- (ancestor::package)[last()] is buggy in MSXML3, fixed in SP1? -->
<xsl:variable name="package.name" select="@package"/>
<tr>
<td nowrap="nowrap">
<a target="classFrame">
@@ -295,7 +306,7 @@ H6 {
<p>
<table width="100%">
<xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
<xsl:sort select="@nam e"/>
<xsl:sort select="@packag e"/>
</xsl:apply-templates>
</table>
</p>
@@ -321,7 +332,7 @@ H6 {
<xsl:with-param name="package.name"/>
</xsl:call-template>
</head>
<body onload="open('allclasses-frame.html','classListFrame')" >
<body>
<xsl:call-template name="pageHeader"/>
<h2>Summary</h2>
<xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
@@ -331,20 +342,20 @@ H6 {
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<tr bgcolor="#A6CAF0" valign="top">
<td><b>Tests</b ></td>
<td><b>Failures</b ></td>
<td><b>Errors</b ></td>
<td><b>Success rate</b ></td>
<td><b>Time</b ></td>
<td><strong>Tests</strong ></td>
<td><strong>Failures</strong ></td>
<td><strong>Errors</strong ></td>
<td><strong>Success rate</strong ></td>
<td><strong>Time</strong ></td>
</tr>
<tr bgcolor="#EEEEE" valign="top">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$failureCount > 0">Failure </xsl:when>
<xsl:when test="$errorCount > 0">Error </xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$errorCount > 0">Error </xsl:when>
<xsl:when test="$failureCount > 0">Failure </xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td><xsl:value-of select="$testCount"/></td>
<td><xsl:value-of select="$failureCount"/></td>
<td><xsl:value-of select="$errorCount"/></td>
@@ -364,7 +375,7 @@ H6 {
<table border="0" width="95%">
<tr>
<td style="text-align: justify;">
Note: <i>failures</i> are anticipated and checked for with assertions while <i>errors</i > are unanticipated.
Note: <em>failures</em> are anticipated and checked for with assertions while <em>errors</em > are unanticipated.
</td>
</tr>
</table>
@@ -377,13 +388,14 @@ H6 {
<!-- get the node set containing all testsuites that have the same package -->
<xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/>
<tr bgcolor="#EEEEE" valign="top">
<!-- display a failure if there is any failure/error in the package -->
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="sum($insamepackage/@errors) + sum($insamepackage/@failures) > 0">Failure</xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<!-- display a failure if there is any failure/error in the package -->
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="sum($insamepackage/@errors) > 0">Error</xsl:when>
<xsl:when test="sum($insamepackage/@failures) > 0">Failure</xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td><a href="{translate(@package,'.','/')}/package-summary.html"><xsl:value-of select="@package"/></a></td>
<td><xsl:value-of select="sum($insamepackage/@tests)"/></td>
<td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
@@ -403,13 +415,13 @@ H6 {
<xsl:template name="package.summary">
<xsl:param name="name"/>
<HTML >
<HEAD >
<html >
<head >
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$name"/>
</xsl:call-template>
</HEAD >
<BODY >
</head >
<body >
<xsl:attribute name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
<xsl:call-template name="pageHeader"/>
<h3>Package <xsl:value-of select="$name"/></h3>
@@ -421,7 +433,7 @@ H6 {
<xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = $name]"/>
<xsl:if test="count($insamepackage) > 0">
<H2>Classes</H 2>
<h2>Classes</h 2>
<p>
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<xsl:call-template name="testsuite.test.header"/>
@@ -431,8 +443,8 @@ H6 {
</table>
</p>
</xsl:if>
</BODY >
</HTML >
</body >
</html >
</xsl:template>
@@ -457,7 +469,7 @@ H6 {
<!-- create the link to the stylesheet based on the package name -->
<xsl:template name="create.stylesheet.link">
<xsl:param name="package.name"/>
<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 >
<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 >
</xsl:template>
@@ -476,32 +488,32 @@ H6 {
<!-- class header -->
<xsl:template name="testsuite.test.header">
<tr bgcolor="#A6CAF0" valign="top">
<td width="80%"><b>Name</b ></td>
<td><b>Tests</b ></td>
<td><b>Errors</b ></td>
<td><b>Failures</b ></td>
<td nowrap="nowrap"><b>Time(s)</b ></td>
<td width="80%"><strong>Name</strong ></td>
<td><strong>Tests</strong ></td>
<td><strong>Errors</strong ></td>
<td><strong>Failures</strong ></td>
<td nowrap="nowrap"><strong>Time(s)</strong ></td>
</tr>
</xsl:template>
<!-- method header -->
<xsl:template name="testcase.test.header">
<tr bgcolor="#A6CAF0" valign="top">
<td><b>Name</b ></td>
<td><b>Status</b ></td>
<td width="80%"><b>Type</b ></td>
<td nowrap="nowrap"><b>Time(s)</b ></td>
<td><strong>Name</strong ></td>
<td><strong>Status</strong ></td>
<td width="80%"><strong>Type</strong ></td>
<td nowrap="nowrap"><strong>Time(s)</strong ></td>
</tr>
</xsl:template>
<!-- class information -->
<xsl:template match="testsuite" mode="print.test">
<tr bgcolor="#EEEEE" valign="top">
<tr bgcolor="#EEEEE" valign="top">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="@failures[.> 0]">Failure</xsl:when>
<xsl:when test="@errors[.> 0]">Error</xsl:when>
<xsl:when test="@failures[.> 0]">Failure</xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -520,7 +532,8 @@ H6 {
<tr bgcolor="#EEEEE" valign="top">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="failure | error">Error</xsl:when>
<xsl:when test="error">Error</xsl:when>
<xsl:when test="failure">Failure</xsl:when>
<xsl:otherwise>TableRowColor</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@@ -558,7 +571,7 @@ H6 {
<xsl:call-template name="display-failures"/>
</xsl:template>
<!-- Style for the error and failure in the tescase template -->
<!-- Style for the error and failure in the test case template -->
<xsl:template name="display-failures">
<xsl:choose>
<xsl:when test="not(@message)">N/A</xsl:when>
@@ -573,7 +586,7 @@ H6 {
<xsl:with-param name="word" select="."/>
</xsl:call-template>
</code>
<!-- the later is better but might be problematic for non-21" monitors... -->
<!-- the latt er is better but might be problematic for non-21" monitors... -->
<!--pre><xsl:value-of select="."/></pre-->
</xsl:template>
@@ -606,6 +619,5 @@ H6 {
<xsl:param name="value"/>
<xsl:value-of select="format-number($value,'0.00%')"/>
</xsl:template>
</xsl:stylesheet>