Browse Source

Make HTML generated by <junitreport> look more like valid HTML.

PR: 12604
Submitted by:	Ville Skytt� <ville.skytta at iki.fi>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273358 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
1e75ac7d0d
2 changed files with 33 additions and 33 deletions
  1. +23
    -25
      src/etc/junit-frames.xsl
  2. +10
    -8
      src/etc/junit-noframes.xsl

+ 23
- 25
src/etc/junit-frames.xsl View File

@@ -158,13 +158,13 @@
<frame src="allclasses-frame.html" name="classListFrame"/> <frame src="allclasses-frame.html" name="classListFrame"/>
</frameset> </frameset>
<frame src="overview-summary.html" name="classFrame"/> <frame src="overview-summary.html" name="classFrame"/>
<noframes>
<h2>Frame Alert</h2>
<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>
</noframes>
</frameset> </frameset>
<noframes>
<h2>Frame Alert</h2>
<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>
</noframes>
</html> </html>
</xsl:template> </xsl:template>


@@ -227,22 +227,24 @@ 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"/>
<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>
<html> <html>
<head> <head>
<title>Unit Test Results: <xsl:value-of select="$class.name"/></title>
<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>
<script language="JavaScript">
<script type="text/javascript" language="JavaScript">
var TestCases = new Array(); var TestCases = new Array();
var cur; var cur;
<xsl:apply-templates select="properties"/> <xsl:apply-templates select="properties"/>
</script> </script>
<script language="JavaScript"><![CDATA[
<script type="text/javascript" language="JavaScript"><![CDATA[
function displayProperties (name) { function displayProperties (name) {
var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1'); var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
var doc = win.document.open(); var doc = win.document.open();
doc.write("<html><head><title>Properties of " + name + "</title>"); doc.write("<html><head><title>Properties of " + name + "</title>");
doc.write("<style>")
doc.write("<style type=\"text/css\">");
doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }"); doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }");
doc.write("table tr td, table tr th { font-size: 68%; }"); doc.write("table tr td, table tr th { font-size: 68%; }");
doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }"); doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
@@ -268,7 +270,7 @@ h6 {
</head> </head>
<body> <body>
<xsl:call-template name="pageHeader"/> <xsl:call-template name="pageHeader"/>
<h3>Class <xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></h3>
<h3>Class <xsl:value-of select="$class.name"/></h3>


<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
@@ -277,7 +279,6 @@ h6 {
</table> </table>
<h2>Tests</h2> <h2>Tests</h2>
<p>
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
<xsl:call-template name="testcase.test.header"/> <xsl:call-template name="testcase.test.header"/>
<!-- <!--
@@ -291,7 +292,6 @@ h6 {
</xsl:if> </xsl:if>
<xsl:apply-templates select="./testcase" mode="print.test"/> <xsl:apply-templates select="./testcase" mode="print.test"/>
</table> </table>
</p>
<div class="Properties"> <div class="Properties">
<a> <a>
<xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute> <xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
@@ -341,6 +341,7 @@ h6 {
<xsl:param name="name"/> <xsl:param name="name"/>
<html> <html>
<head> <head>
<title>Unit Test Classes: <xsl:value-of select="$name"/></title>
<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>
@@ -355,7 +356,6 @@ h6 {
</table> </table>
<h2>Classes</h2> <h2>Classes</h2>
<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"/>
@@ -366,7 +366,6 @@ h6 {
</tr> </tr>
</xsl:for-each> </xsl:for-each>
</table> </table>
</p>
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
@@ -379,19 +378,18 @@ h6 {
<xsl:template match="testsuites" mode="all.classes"> <xsl:template match="testsuites" mode="all.classes">
<html> <html>
<head> <head>
<title>All Unit Test Classes</title>
<xsl:call-template name="create.stylesheet.link"> <xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name"/> <xsl:with-param name="package.name"/>
</xsl:call-template> </xsl:call-template>
</head> </head>
<body> <body>
<h2>Classes</h2> <h2>Classes</h2>
<p>
<table width="100%"> <table width="100%">
<xsl:apply-templates select="testsuite" mode="all.classes"> <xsl:apply-templates select="testsuite" mode="all.classes">
<xsl:sort select="@name"/> <xsl:sort select="@name"/>
</xsl:apply-templates> </xsl:apply-templates>
</table> </table>
</p>
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
@@ -421,6 +419,7 @@ h6 {
<xsl:template match="testsuites" mode="all.packages"> <xsl:template match="testsuites" mode="all.packages">
<html> <html>
<head> <head>
<title>All Unit Test Packages</title>
<xsl:call-template name="create.stylesheet.link"> <xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name"/> <xsl:with-param name="package.name"/>
</xsl:call-template> </xsl:call-template>
@@ -428,13 +427,11 @@ h6 {
<body> <body>
<h2><a href="overview-summary.html" target="classFrame">Home</a></h2> <h2><a href="overview-summary.html" target="classFrame">Home</a></h2>
<h2>Packages</h2> <h2>Packages</h2>
<p>
<table width="100%">
<xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
<xsl:sort select="@package"/>
</xsl:apply-templates>
</table>
</p>
<table width="100%">
<xsl:apply-templates select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]" mode="all.packages">
<xsl:sort select="@package"/>
</xsl:apply-templates>
</table>
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
@@ -453,6 +450,7 @@ h6 {
<xsl:template match="testsuites" mode="overview.packages"> <xsl:template match="testsuites" mode="overview.packages">
<html> <html>
<head> <head>
<title>Unit Test Results: Summary</title>
<xsl:call-template name="create.stylesheet.link"> <xsl:call-template name="create.stylesheet.link">
<xsl:with-param name="package.name"/> <xsl:with-param name="package.name"/>
</xsl:call-template> </xsl:call-template>
@@ -605,7 +603,7 @@ h6 {
<table width="100%"> <table width="100%">
<tr> <tr>
<td align="left"></td> <td align="left"></td>
<td align="right">Designed for use with <a href='http://www.junit.org'>JUnit</a> and <a href='http://jakarta.apache.org'>Ant</a>.</td>
<td align="right">Designed for use with <a href="http://www.junit.org/">JUnit</a> and <a href="http://jakarta.apache.org/">Ant</a>.</td>
</tr> </tr>
</table> </table>
<hr size="1"/> <hr size="1"/>
@@ -706,8 +704,8 @@ h6 {
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<!-- display the stacktrace --> <!-- display the stacktrace -->
<br/><br/>
<code> <code>
<p/>
<xsl:call-template name="br-replace"> <xsl:call-template name="br-replace">
<xsl:with-param name="word" select="."/> <xsl:with-param name="word" select="."/>
</xsl:call-template> </xsl:call-template>


+ 10
- 8
src/etc/junit-noframes.xsl View File

@@ -1,5 +1,6 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
<xsl:output method="html" indent="yes" encoding="US-ASCII"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
<xsl:decimal-format decimal-separator="." grouping-separator="," /> <xsl:decimal-format decimal-separator="." grouping-separator="," />
<!-- <!--
The Apache Software License, Version 1.1 The Apache Software License, Version 1.1
@@ -67,8 +68,9 @@
--> -->
<xsl:template match="testsuites"> <xsl:template match="testsuites">
<HTML>
<HEAD>
<html>
<head>
<title>Unit Test Results</title>
<style type="text/css"> <style type="text/css">
body { body {
font:normal 68% verdana,arial,helvetica; font:normal 68% verdana,arial,helvetica;
@@ -118,7 +120,7 @@
text-align:right; text-align:right;
} }
</style> </style>
<script language="JavaScript">
<script type="text/javascript" language="JavaScript">
var TestCases = new Array(); var TestCases = new Array();
var cur; var cur;
<xsl:for-each select="./testsuite"> <xsl:for-each select="./testsuite">
@@ -126,7 +128,7 @@
</xsl:for-each> </xsl:for-each>


</script> </script>
<script language="JavaScript"><![CDATA[
<script type="text/javascript" language="JavaScript"><![CDATA[
function displayProperties (name) { function displayProperties (name) {
var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1'); var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
var doc = win.document.open(); var doc = win.document.open();
@@ -154,7 +156,7 @@
} }
]]> ]]>
</script> </script>
</HEAD>
</head>
<body> <body>
<a name="top"></a> <a name="top"></a>
<xsl:call-template name="pageHeader"/> <xsl:call-template name="pageHeader"/>
@@ -175,7 +177,7 @@
<xsl:call-template name="classes"/> <xsl:call-template name="classes"/>
</body> </body>
</HTML>
</html>
</xsl:template> </xsl:template>
@@ -454,7 +456,7 @@
</xsl:choose> </xsl:choose>
<!-- display the stacktrace --> <!-- display the stacktrace -->
<code> <code>
<p/>
<br/><br/>
<xsl:call-template name="br-replace"> <xsl:call-template name="br-replace">
<xsl:with-param name="word" select="."/> <xsl:with-param name="word" select="."/>
</xsl:call-template> </xsl:call-template>


Loading…
Cancel
Save