diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2010-03-23 02:15:52 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-05 17:17:47 +0100 |
commit | 873a72da1d8d5595b1648ffba2c846023985397b (patch) | |
tree | c221ecc6a444e6461be2d8c74417f6d603b67e30 /test | |
parent | 5e315f224c8e9d7fc4f3919da5583fdda7f29062 (diff) | |
download | usdx-873a72da1d8d5595b1648ffba2c846023985397b.tar.gz usdx-873a72da1d8d5595b1648ffba2c846023985397b.tar.xz usdx-873a72da1d8d5595b1648ffba2c846023985397b.zip |
beautification of xml output of cppunit
Diffstat (limited to 'test')
-rw-r--r-- | test/report.xsl | 125 | ||||
-rw-r--r-- | test/test.cpp | 1 |
2 files changed, 126 insertions, 0 deletions
diff --git a/test/report.xsl b/test/report.xsl new file mode 100644 index 00000000..b394cdbe --- /dev/null +++ b/test/report.xsl @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding='shift_jis' standalone='yes' ?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xml:lang="ja"> + +<xsl:template match="/"> +<HTML> +<HEAD> +<TITLE>Test Report</TITLE> +<STYLE> +TABLE { color:#222222; font-size:10pt; font-family:'‚l‚r ƒSƒVƒbƒN' 'sanserif'; } +TH { font-weight:normal; color:#FFFFFF; background-color:#888888; } +TR.check { background-color:#EEEEEE } +TD.check { background-color:#EEEEEE } +H1 { color:#111111; font-family:'Times New Roman' '‚l‚r ‚o–¾’©' 'serif'; border-style:solid; border-width:0px; border-bottom-width:3px; border-bottom-color:#444488; } +H2 { color:#222222; font-family:'Times New Roman' '‚l‚r ‚o–¾’©' 'serif'; border-style:solid; border-width:0px; border-bottom-width:2px; border-bottom-color:#444488; } +H3 { color:#333333; font-family:'Times New Roman' '‚l‚r ‚o–¾’©' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#444488; margin-bottom:8px; } +H4 { color:#444444; font-family:'Times New Roman' '‚l‚r ‚o–¾’©' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#CCCCDD; margin-bottom:8px; } +H5 { color:#555555; font-family:'Times New Roman' '‚l‚r ‚o–¾’©' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#EEEEFF; margin-bottom:8px; } +H6 { color:#666666; font-family:'Times New Roman' '‚l‚r ‚o–¾’©' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#F8F8FF; margin-bottom:8px; } + +SPAN.good { color:#006666; font-weight:bold; } +SPAN.critical { color:#880000; font-weight:bold; } +</STYLE> +</HEAD> +<BODY> + <H1>Test Report</H1> + <xsl:apply-templates select="/TestRun/*"/> +</BODY> +</HTML> +</xsl:template> + +<xsl:template match="FailedTests"> + <H2>FailedTests</H2> + <xsl:choose> + <xsl:when test="FailedTest"> + <TABLE> + <TR> + <TH>id</TH> + <TH>Name</TH> + <TH>FailureType</TH> + <TH>Location</TH> + <TH>Message</TH> + </TR> + <xsl:apply-templates select="FailedTest"/> + </TABLE> + </xsl:when> + <xsl:otherwise> + <SPAN class="good">No failed test.</SPAN> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="FailedTest"> + <TR> + <TD align="right" valign='top'><xsl:value-of select="@id"/></TD> + <TD valign='top'><xsl:apply-templates select="Name"/></TD> + <TD valign='top'><xsl:apply-templates select="FailureType"/></TD> + <TD valign='top'><xsl:apply-templates select="Location"/></TD> + <TD valign='top'><pre><xsl:apply-templates select="Message"/></pre></TD> + </TR> +</xsl:template> +<xsl:template match="Name|FailureType|Message"><xsl:value-of select="."/></xsl:template> +<xsl:template match="Location"> + <xsl:if test="."> + line #<xsl:value-of select="Line"/> in <xsl:value-of select="File"/> + </xsl:if> +</xsl:template> + +<xsl:template match="SuccessfulTests"> + <H2>SuccessfulTests</H2> + <xsl:choose> + <xsl:when test="Test"> + <TABLE> + <TR> + <TH>id</TH> + <TH>Name</TH> + </TR> + <xsl:apply-templates select="Test"/> + </TABLE> + </xsl:when> + <xsl:otherwise> + <SPAN class="critical">No sucessful test.</SPAN> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="Test"> + <TR> + <TD align="right"><xsl:value-of select="@id"/></TD> + <TD><xsl:apply-templates select="Name"/></TD> + </TR> +</xsl:template> + +<xsl:template match="Statistics"> + <H2>Statistics</H2> + <TABLE> + <TR> + <TH>Status</TH> + <TH>Number</TH> + </TR> + + <TR> + <TD>Tests</TD> + <TD align="right"><xsl:value-of select="Tests"/></TD> + </TR> + + <TR> + <TD>FailuresTotal</TD> + <TD align="right"><xsl:value-of select="FailuresTotal"/></TD> + </TR> + + <TR> + <TD>Errors</TD> + <TD align="right"><xsl:value-of select="Errors"/></TD> + </TR> + + <TR> + <TD>Failures</TD> + <TD align="right"><xsl:value-of select="Failures"/></TD> + </TR> + + </TABLE> +</xsl:template> + +</xsl:stylesheet> diff --git a/test/test.cpp b/test/test.cpp index 53ee3a89..b6e7d806 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -58,6 +58,7 @@ int main(int argc, char **argv) std::fstream filestr; filestr.open ("test.xml", std::fstream::out | std::fstream::trunc); CppUnit::XmlOutputter xml_outputter(&result, filestr); + xml_outputter.setStyleSheet("report.xsl"); xml_outputter.write(); filestr.close(); |