@@ -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.
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.
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
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
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:
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="'.'"/>
<xsl:param name="output.dir" select="'.'"/>
@@ -98,61 +98,72 @@
</xsl:template>
</xsl:template>
<xsl:template name="index.html">
<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>
<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.
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>
</noframes>
</HTML >
</html >
</xsl:template>
</xsl:template>
<!-- this is the stylesheet css to use for nearly everything -->
<!-- this is the stylesheet css to use for nearly everything -->
<xsl:template name="stylesheet.css">
<xsl:template name="stylesheet.css">
BODY {
body {
font:normal 68% verdana,arial,helvetica;
font:normal 68% verdana,arial,helvetica;
color:#000000;
color:#000000;
}
}
TD {
FONT-SIZE : 68%
td {
font-size : 68%
}
}
P {
p {
line-height:1.5em;
line-height:1.5em;
margin-top:0.5em; margin-bottom:1.0em;
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 {
.Error {
font-weight:bold; color:red;
font-weight:bold;
color:red;
}
}
.Failure {
.Failure {
font-weight:bold; color:purple;
font-weight:bold;
color:purple;
}
}
</xsl:template>
</xsl:template>
@@ -165,15 +176,15 @@ H6 {
====================================================================== -->
====================================================================== -->
<xsl:template match="testsuite" mode="class.details">
<xsl:template match="testsuite" mode="class.details">
<xsl:variable name="package.name" select="@package"/>
<xsl:variable name="package.name" select="@package"/>
<HTML >
<HEAD >
<html >
<head >
<xsl:call-template name="create.stylesheet.link">
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$package.name"/>
<xsl:with-param name="package.name" select="$package.name"/>
</xsl:call-template>
</xsl:call-template>
</HEAD >
<BODY >
</head >
<body >
<xsl:call-template name="pageHeader"/>
<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%">
<table border="0" cellpadding="5" cellspacing="2" width="95%">
@@ -181,7 +192,7 @@ H6 {
<xsl:apply-templates select="." mode="print.test"/>
<xsl:apply-templates select="." mode="print.test"/>
</table>
</table>
<H2>Tests</H 2>
<h2>Tests</h 2>
<p>
<p>
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<xsl:call-template name="testcase.test.header"/>
<xsl:call-template name="testcase.test.header"/>
@@ -189,8 +200,8 @@ H6 {
</table>
</table>
</p>
</p>
</BODY >
</HTML >
</body >
</html >
</xsl:template>
</xsl:template>
@@ -202,24 +213,24 @@ H6 {
<!-- list of classes in a package -->
<!-- list of classes in a package -->
<xsl:template name="classes.list">
<xsl:template name="classes.list">
<xsl:param name="name"/>
<xsl:param name="name"/>
<HTML >
<HEAD >
<html >
<head >
<xsl:call-template name="create.stylesheet.link">
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$name"/>
<xsl:with-param name="package.name" select="$name"/>
</xsl:call-template>
</xsl:call-template>
</HEAD >
<BODY >
</head >
<body >
<table width="100%">
<table width="100%">
<tr>
<tr>
<td nowrap="nowrap">
<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>
</td>
</tr>
</tr>
</table>
</table>
<H2>Classes</H 2>
<h2>Classes</h 2>
<p>
<p>
<TABLE WIDTH ="100%">
<table width ="100%">
<xsl:for-each select="/testsuites/testsuite[./@package = $name]">
<xsl:for-each select="/testsuites/testsuite[./@package = $name]">
<xsl:sort select="@name"/>
<xsl:sort select="@name"/>
<tr>
<tr>
@@ -228,10 +239,10 @@ H6 {
</td>
</td>
</tr>
</tr>
</xsl:for-each>
</xsl:for-each>
</TABLE >
</table >
</p>
</p>
</BODY >
</HTML >
</body >
</html >
</xsl:template>
</xsl:template>
@@ -260,8 +271,8 @@ H6 {
</xsl:template>
</xsl:template>
<xsl:template match="testsuite" mode="all.classes">
<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>
<tr>
<td nowrap="nowrap">
<td nowrap="nowrap">
<a target="classFrame">
<a target="classFrame">
@@ -295,7 +306,7 @@ H6 {
<p>
<p>
<table width="100%">
<table width="100%">
<xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
<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>
</xsl:apply-templates>
</table>
</table>
</p>
</p>
@@ -321,7 +332,7 @@ H6 {
<xsl:with-param name="package.name"/>
<xsl:with-param name="package.name"/>
</xsl:call-template>
</xsl:call-template>
</head>
</head>
<body onload="open('allclasses-frame.html','classListFrame')" >
<body>
<xsl:call-template name="pageHeader"/>
<xsl:call-template name="pageHeader"/>
<h2>Summary</h2>
<h2>Summary</h2>
<xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
<xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
@@ -331,20 +342,20 @@ H6 {
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<tr bgcolor="#A6CAF0" valign="top">
<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>
<tr bgcolor="#EEEEE" valign="top">
<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="$testCount"/></td>
<td><xsl:value-of select="$failureCount"/></td>
<td><xsl:value-of select="$failureCount"/></td>
<td><xsl:value-of select="$errorCount"/></td>
<td><xsl:value-of select="$errorCount"/></td>
@@ -364,7 +375,7 @@ H6 {
<table border="0" width="95%">
<table border="0" width="95%">
<tr>
<tr>
<td style="text-align: justify;">
<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>
</td>
</tr>
</tr>
</table>
</table>
@@ -377,13 +388,14 @@ H6 {
<!-- get the node set containing all testsuites that have the same package -->
<!-- get the node set containing all testsuites that have the same package -->
<xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/>
<xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/>
<tr bgcolor="#EEEEE" valign="top">
<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><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/@tests)"/></td>
<td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
<td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
@@ -403,13 +415,13 @@ H6 {
<xsl:template name="package.summary">
<xsl:template name="package.summary">
<xsl:param name="name"/>
<xsl:param name="name"/>
<HTML >
<HEAD >
<html >
<head >
<xsl:call-template name="create.stylesheet.link">
<xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name" select="$name"/>
<xsl:with-param name="package.name" select="$name"/>
</xsl:call-template>
</xsl:call-template>
</HEAD >
<BODY >
</head >
<body >
<xsl:attribute name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
<xsl:attribute name="onload">open('package-frame.html','classListFrame')</xsl:attribute>
<xsl:call-template name="pageHeader"/>
<xsl:call-template name="pageHeader"/>
<h3>Package <xsl:value-of select="$name"/></h3>
<h3>Package <xsl:value-of select="$name"/></h3>
@@ -421,7 +433,7 @@ H6 {
<xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = $name]"/>
<xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = $name]"/>
<xsl:if test="count($insamepackage) > 0">
<xsl:if test="count($insamepackage) > 0">
<H2>Classes</H 2>
<h2>Classes</h 2>
<p>
<p>
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<table border="0" cellpadding="5" cellspacing="2" width="95%">
<xsl:call-template name="testsuite.test.header"/>
<xsl:call-template name="testsuite.test.header"/>
@@ -431,8 +443,8 @@ H6 {
</table>
</table>
</p>
</p>
</xsl:if>
</xsl:if>
</BODY >
</HTML >
</body >
</html >
</xsl:template>
</xsl:template>
@@ -457,7 +469,7 @@ H6 {
<!-- create the link to the stylesheet based on the package name -->
<!-- create the link to the stylesheet based on the package name -->
<xsl:template name="create.stylesheet.link">
<xsl:template name="create.stylesheet.link">
<xsl:param name="package.name"/>
<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>
</xsl:template>
@@ -476,32 +488,32 @@ H6 {
<!-- class header -->
<!-- class header -->
<xsl:template name="testsuite.test.header">
<xsl:template name="testsuite.test.header">
<tr bgcolor="#A6CAF0" valign="top">
<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>
</tr>
</xsl:template>
</xsl:template>
<!-- method header -->
<!-- method header -->
<xsl:template name="testcase.test.header">
<xsl:template name="testcase.test.header">
<tr bgcolor="#A6CAF0" valign="top">
<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>
</tr>
</xsl:template>
</xsl:template>
<!-- class information -->
<!-- class information -->
<xsl:template match="testsuite" mode="print.test">
<xsl:template match="testsuite" mode="print.test">
<tr bgcolor="#EEEEE" valign="top">
<tr bgcolor="#EEEEE" valign="top">
<xsl:attribute name="class">
<xsl:attribute name="class">
<xsl:choose>
<xsl:choose>
<xsl:when test="@failures[.> 0]">Failure</xsl:when>
<xsl:when test="@errors[.> 0]">Error</xsl:when>
<xsl:when test="@errors[.> 0]">Error</xsl:when>
<xsl:when test="@failures[.> 0]">Failure</xsl:when>
<xsl:otherwise>Pass</xsl:otherwise>
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:choose>
</xsl:attribute>
</xsl:attribute>
@@ -520,7 +532,8 @@ H6 {
<tr bgcolor="#EEEEE" valign="top">
<tr bgcolor="#EEEEE" valign="top">
<xsl:attribute name="class">
<xsl:attribute name="class">
<xsl:choose>
<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:otherwise>TableRowColor</xsl:otherwise>
</xsl:choose>
</xsl:choose>
</xsl:attribute>
</xsl:attribute>
@@ -558,7 +571,7 @@ H6 {
<xsl:call-template name="display-failures"/>
<xsl:call-template name="display-failures"/>
</xsl:template>
</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:template name="display-failures">
<xsl:choose>
<xsl:choose>
<xsl:when test="not(@message)">N/A</xsl:when>
<xsl:when test="not(@message)">N/A</xsl:when>
@@ -573,7 +586,7 @@ H6 {
<xsl:with-param name="word" select="."/>
<xsl:with-param name="word" select="."/>
</xsl:call-template>
</xsl:call-template>
</code>
</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-->
<!--pre><xsl:value-of select="."/></pre-->
</xsl:template>
</xsl:template>
@@ -606,6 +619,5 @@ H6 {
<xsl:param name="value"/>
<xsl:param name="value"/>
<xsl:value-of select="format-number($value,'0.00%')"/>
<xsl:value-of select="format-number($value,'0.00%')"/>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>