ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human
ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human
ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov, or lcov into human readable reports in various formats.
The reports show the coverage quotas and also visualize which lines of your source code have been covered.
ReportGenerator supports merging several coverage files into a single report.
ReportGenerator is a commandline tool which works with full .NET Framework and .NET Core.
Use the online configuration tool to get started quickly.
| Package | Platforms | Installation/Usage |
|---|---|---|
| ReportGenerator |
.NET Core >=8.0 .NET Framework 4.7 |
Use this package if your project is based on .NET Framework or .NET Core and you want to use ReportGenerator via the command line or a build script. Usage dotnet $(UserProfile).nuget\packages\reportgenerator\\x.y.z\tools\net8.0\ReportGenerator.dll [options]$(UserProfile).nuget\packages\reportgenerator\\x.y.z\tools\net10.0\ReportGenerator.exe [options]$(UserProfile)\.nuget\packages\reportgenerator\\x.y.z\tools\net47\ReportGenerator.exe [options] |
| dotnet-reportgenerator-globaltool |
.NET Core >=8.0 | Use this package if your project is based on .NET Core and you want to use ReportGenerator as a (global) 'DotnetTool'. Installation dotnet tool install -g dotnet-reportgenerator-globaltooldotnet tool install dotnet-reportgenerator-globaltool --tool-path toolsdotnet new tool-manifestdotnet tool install dotnet-reportgenerator-globaltoolUsage reportgenerator [options]tools\reportgenerator.exe [options]dotnet reportgenerator [options] |
| ReportGenerator.Core |
.NET Standard 2.0 | Use this package if you want to write a custom plugin for ReportGenerator or if you want to call/execute ReportGenerator within your code base. Plugin development Custom reports Custom history storage |
| Azure DevOps extension | .NET Core >=8.0 | Add the Azure DevOps extension to your build pipeline. Learn more |
| GitHub Actions | .NET Core >=8.0 | Add the GitHub Action to your build pipeline. Learn more |
Use the online configuration tool to get started quickly.
The more advanced settings are documented in the wiki.
…All the above parameters can also be persisted in a .netconfig file, under a [ReportGenerator]
section. Examples:
[ReportGenerator]
reports = "coverage.xml"
targetdir = "C:\\report"
reporttypes = "Latex;HtmlSummary"
assemblyfilters = "+Test;-Test"
classfilters = "+Test2;-Test2"All the plural options can also be specified as multiple singular entries, like:
[ReportGenerator]
report = "coverage1.xml"
report = "coverage2.xml"
reporttype = "Latex"
reporttype = "HtmlSummary"
assemblyfilter = "+Test"
assemblyfilter = "-Test"
classfilter = "+Test2"
classfilter = "-Test2"
filefilter = "+cs"
filefilter = "-vb"
riskhotspotassemblyfilter = "+Test"
riskhotspotassemblyfilter = "-Test"
riskhotspotclassfilter = "+Test2"
riskhotspotclassfilter = "-Test2"
sourcedir = "src"
sourcedir = "test"Adding/removing values is trivial using the dotnet-config CLI:
# set a single-valued variable
dotnet config reportgenerator.reporttypes Latex;HtmlSummary
# add to multi-valued variable
dotnet config --add reportgenerator.report coverage3.xml
# clear all multi-valued entries for a variable
dotnet config --unset-all reportgenerator.assemblyfilterOf course it's equally trivial to just edit the .netconfig file by hand.
A MSBuild task also exists:
…The MSBuild task parameters can be complemented with the .netconfig, if used. That means that parameters
can be omitted if they are provided via .netconfig, which is useful when reusing fixed settings across
multiple projects in a solution, where the MSBuild task is only provided the dynamic values for the current
project:
Given the following .netconfig:
[ReportGenerator]
reporttypes = "Html;Latex"
targetdirectory = "report"
historydirectory = "history"
assemblyfilters = "+Include;-Excluded"
verbosityLevel = "Verbose"The above target could be simplified as:
<Target Name="Coverage">
<ItemGroup>
<CoverageFiles Include="OpenCover.xml" />
</ItemGroup>
<ReportGenerator ProjectDirectory="$(MSBuildProjectDirectory)"
ReportFiles="@(CoverageFiles)"
Plugins="CustomReports.dll" />
</Target>ReportGenerator supports several input and output formats.
The wiki explains the different output formats or you can download sample reports of all supported output formats.
If you need a custom format, you can create a plugin.
| Input formats | Output formats |
|---|---|
|
|
The screenshots show two snippets of the generated reports:
Badges
Badges in SVG format can be generated if -reporttypes:Badges is used:
Example:
The following extensions exist to visualize coverage in Visual Studio:
| Name | Coverage tool | Links |
|---|---|---|
| Run Coverlet Report VS2022 | coverlet | GitHub Marketplace |
| FineCodeCoverage | coverlet, OpenCover | GitHub Marketplace |
Author: Daniel Palme
Blog: www.palmmedia.de
Twitter: @danielpalme
No open issues yet, or sync has not completed.