Skip to content

Instantly share code, notes, and snippets.

@Trass3r
Last active September 12, 2017 13:58
Show Gist options
  • Select an option

  • Save Trass3r/e8b5bdf3c3a59697c49bf8ab0dd2e183 to your computer and use it in GitHub Desktop.

Select an option

Save Trass3r/e8b5bdf3c3a59697c49bf8ab0dd2e183 to your computer and use it in GitHub Desktop.
OpenCppCoverage for TeamCity
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="text" encoding="utf-8"/>
<xsl:variable name='nl'>
<xsl:text>&#xa;</xsl:text>
</xsl:variable>
<xsl:template match="/">
<xsl:variable name="total_lines" select="count(/coverage/packages/package/classes/class/lines/line)" />
<xsl:variable name="covered_lines" select="count(/coverage/packages/package/classes/class/lines/line[@hits!='0'])" />
<xsl:text>##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='</xsl:text>
<xsl:value-of select="$total_lines"/>
<xsl:text>']</xsl:text>
<xsl:value-of select="$nl"/>
<xsl:text>##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='</xsl:text>
<xsl:value-of select="$covered_lines"/>
<xsl:text>']</xsl:text>
<xsl:value-of select="$nl"/>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment