Skip to content

Instantly share code, notes, and snippets.

@TheBurnDoc
Created October 20, 2013 12:35
Show Gist options
  • Save TheBurnDoc/7068979 to your computer and use it in GitHub Desktop.
Save TheBurnDoc/7068979 to your computer and use it in GitHub Desktop.
XSL transform to produce a human readable HTML page from Google Test XML output
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Google Test Report</title>
</head>
<body>
<table cellpadding="2" cellspacing="0" width="100%" border="1">
<tr bgcolor="#CCCCCC">
<th>Test Suite</th><th>Test Case</th><th>Result</th><th>Message(s)</th><th>Run Time</th>
</tr>
<xsl:for-each select="testsuites/testsuite/testcase">
<tr>
<td><xsl:value-of select="@classname"/></td>
<td><xsl:value-of select="@name"/></td>
<xsl:choose>
<xsl:when test="failure">
<td bgcolor="#FF0000" align="center"><b>FAIL</b></td>
<td>
<xsl:for-each select="failure">
<xsl:value-of select="@message"/><br/>
</xsl:for-each>
</td>
</xsl:when>
<xsl:otherwise>
<td bgcolor="#00FF00" align="center"><b>PASS</b></td>
<td/>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="@time"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment