forked from OpenCover/opencover
-
Notifications
You must be signed in to change notification settings - Fork 0
Monitoring coverage in Atlassian Bamboo
chillitom edited this page Dec 18, 2012
·
1 revision
The following XSLT will transform OpenCover's XML output to the old NCover 1.x format understood by Atlassian's Bamboo Continuous Integration Server.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" standalone="yes"/>
<xsl:template match="/CoverageSession/Modules">
<coverage>
<xsl:for-each select="Module[not(@skippedDueTo)]">
<module name="{ModuleName}">
<xsl:for-each select="Classes/Class">
<xsl:if test="count(Methods/Method) > 0">
<class name="{FullName}">
<xsl:variable name="className" select="FullName" />
<xsl:for-each select="Methods/Method">
<method class="{$className}">
<xsl:for-each select="SequencePoints/SequencePoint">
<seqpnt visitcount="{@vc}" />
</xsl:for-each>
</method>
</xsl:for-each>
</class>
</xsl:if>
</xsl:for-each>
</module>
</xsl:for-each>
</coverage>
</xsl:template>
</xsl:stylesheet>
Example MSBuild target.
<!-- example msbuild target -->
<Target Name="TranslateCoverageXml">
<ItemGroup>
<CoverageFiles Include="$(TestsDir)\*.opencover" />
</ItemGroup>
<XslTransformation XmlInputPaths="%(CoverageFiles.Identity)"
XslInputPath="$(MSBuildProjectDirectory)\opencover_to_ncover.xslt"
OutputPaths="$(TestsDir)\%(CoverageFiles.FileName).ncover.xml" />
</Target>