Skip to content

Instantly share code, notes, and snippets.

@chillitom
Created December 17, 2012 22:37
Show Gist options
  • Save chillitom/4323072 to your computer and use it in GitHub Desktop.
Save chillitom/4323072 to your computer and use it in GitHub Desktop.

Revisions

  1. chillitom renamed this gist Dec 18, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. chillitom revised this gist Dec 18, 2012. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions gistfile1.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@

    <!-- 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>
  3. chillitom revised this gist Dec 18, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion opencover_to_ncover.xslt
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    <xsl:template match="/CoverageSession/Modules">
    <coverage>
    <xsl:for-each select="Module[not(@skippedDueTo)]">
    <module moduleId="2" name="{ModuleName}">
    <module name="{ModuleName}">
    <xsl:for-each select="Classes/Class">
    <xsl:if test="count(Methods/Method) &gt; 0">
    <class name="{FullName}">
  4. chillitom created this gist Dec 17, 2012.
    26 changes: 26 additions & 0 deletions opencover_to_ncover.xslt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    <?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 moduleId="2" name="{ModuleName}">
    <xsl:for-each select="Classes/Class">
    <xsl:if test="count(Methods/Method) &gt; 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>