ReportGenerator

Project Description

ReportGenerator converts XML reports generated by PartCover, OpenCover or NCover into a readable report in various formats.
The reports do not only show the coverage quota, but also include the source code and visualize which line has been covered.

ReportGenerator supports merging several reports into one.
It is also possible to pass one XML file containing several reports to ReportGenerator (e.g. a build log file).

The following output formats are supported by ReportGenerator:
  • HTML, HTMLSummary
  • XML, XMLSummary
  • Latex, LatexSummary

Compatibility:
Also available as NuGet package: http://nuget.org/List/Packages/ReportGenerator

Additional information about ReportGenerator can be found under Resources.

Author: Daniel Palme
Blog: http://www.palmmedia.de
Twitter: @danielpalme

Screenshots

The screenshots show two snippets of the generated reports:

Screenshot Screenshot

Usage

ReportGenerator is a commandline tool which requires the following parameters:

Parameters:
    ["]-reports:<report>[;<report>][;<report>]["]
    ["]-targetdir:<target directory>["]
    [["]-reporttype:<Html|HtmlSummary|Xml|XmlSummary|Latex|LatexSummary>["]]
    [["]-sourcedirs:<directory>[;<directory>][;<directory>]["]]
    [["]-filters:<(+|-)filter>[;<(+|-)filter>][;<(+|-)filter>]["]]

Explanations:
   Reports: The coverage reports that should be parsed (separated by semicolon).
   Targetdirectory: The directory where the generated report should be saved.
   Reporttype: The output format and scope (Html, HtmlSummary, Xml, XmlSummary,
               Latex, LatexSummary).
   SourceDirectories: Optional directories which contain the corresponding source code
                      (separated by semicolon).
                      The source files are used if coverage report contains classes without path information.
   Filters: Optional list of assemblies that should be included or excluded in the
            report. Exclusion filters take precedence over inclusion filters. 
            Wildcards are allowed.

Default values:
   ReportType: Html

Examples:
   "-reports:coverage.xml" "-targetdir:C:\report"
   "-reports:coverage.xml" "-targetdir:C:\report" -reporttype:Latex
   "-reports:coverage1.xml;coverage2.xml" "-targetdir:report"
   "-reports:coverage.xml" "-targetdir:C:\report" -reporttype:Latex "-sourcedirs:C:\MyProject"
   "-reports:coverage.xml" "-targetdir:C:\report" "-sourcedirs:C:\MyProject1;C:\MyProject2" "-filters:+Included;-Excluded.*"

A MSBuild task also exists:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Coverage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <UsingTask TaskName="ReportGenerator" AssemblyFile="ReportGenerator.exe" />
  <ItemGroup>
    <CoverageFiles Include="partcover.xml" />
    <SourceDirectories Include="C:\MyProject1" />
    <SourceDirectories Include="C:\MyProject2" />
    <Filters Include="+Include" />
    <Filters Include="-Excluded.*" />
  </ItemGroup>
  <Target Name="Coverage">
    <ReportGenerator ReportFiles="@(CoverageFiles)" TargetDirectory="report" ReportType="Latex" SourceDirectories="@(SourceDirectories)" Filters="@(Filters)" />
  </Target>
</Project>

Resources

Last edited Apr 29, 2012 at 11:00 AM by danielpalme, version 17