Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danielpalme/reportgenerator

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.
https://github.com/danielpalme/reportgenerator

code-coverage dotnet-core reporting tdd-utilities testing

Last synced: 7 days ago
JSON representation

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.

Awesome Lists containing this project

README

        

ReportGenerator


ReportGenerator



Powerful code coverage visualization

[![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg?style=for-the-badge)](https://raw.githubusercontent.com/danielpalme/ReportGenerator/main/LICENSE.txt)
[![CI-CD](https://img.shields.io/github/actions/workflow/status/danielpalme/ReportGenerator/ci.yml?style=for-the-badge)](https://github.com/danielpalme/ReportGenerator/actions/workflows/ci.yml)

*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.

[Browse example HTML report](https://reportgenerator.io/resources/reports/Html/index.html)

![Input and output](https://danielpalme.github.io/ReportGenerator/resources/input_output.png)

## License
- ReportGenerator is licensed under the [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0)
- You can support the project by buying a [PRO license](https://reportgenerator.io/pro) or by becoming a [GitHub sponsor](https://github.com/sponsors/danielpalme).
Sponsors have exclusive access to [additional features](https://reportgenerator.io/pro).

## Getting started
*ReportGenerator* is a commandline tool which works with full .NET Framework and .NET Core.
Use the online [configuration tool](https://reportgenerator.io/usage) to get started quickly.

### Install the package matching your platform and needs

|**Package**|**Platforms**|**Installation/Usage**|
|:----------|:------------|:---------------------|
|[ReportGenerator](https://www.nuget.org/packages/ReportGenerator)

[![Nuget](https://img.shields.io/nuget/v/ReportGenerator.svg?style=for-the-badge)![Nuget](https://img.shields.io/nuget/dt/ReportGenerator.svg?style=for-the-badge)](https://www.nuget.org/packages/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\net8.0\ReportGenerator.exe [options]```

```$(UserProfile)\.nuget\packages\reportgenerator\x.y.z\tools\net47\ReportGenerator.exe [options]```|
|[dotnet-reportgenerator-globaltool](https://www.nuget.org/packages/dotnet-reportgenerator-globaltool)

[![Nuget](https://img.shields.io/nuget/v/dotnet-reportgenerator-globaltool.svg?style=for-the-badge)![Nuget](https://img.shields.io/nuget/dt/dotnet-reportgenerator-globaltool.svg?style=for-the-badge)](https://www.nuget.org/packages/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-globaltool```

```dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools```

```dotnet new tool-manifest```
```dotnet tool install dotnet-reportgenerator-globaltool```

**Usage**
```reportgenerator [options]```
```tools\reportgenerator.exe [options]```
```dotnet reportgenerator [options]```|
|[ReportGenerator.Core](https://www.nuget.org/packages/ReportGenerator.Core)

[![Nuget](https://img.shields.io/nuget/v/ReportGenerator.Core.svg?style=for-the-badge)![Nuget](https://img.shields.io/nuget/dt/ReportGenerator.Core.svg?style=for-the-badge)](https://www.nuget.org/packages/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](https://github.com/danielpalme/ReportGenerator/wiki/Custom-reports)
[Custom history storage](https://github.com/danielpalme/ReportGenerator/wiki/Custom-history-storage)|
|[Azure DevOps extension](https://marketplace.visualstudio.com/items?itemName=Palmmedia.reportgenerator)

[![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/Palmmedia.reportgenerator.svg?style=for-the-badge)![Visual Studio Marketplace Installs - Azure DevOps Extension](https://img.shields.io/visual-studio-marketplace/azure-devops/installs/total/Palmmedia.reportgenerator.svg?style=for-the-badge)](https://marketplace.visualstudio.com/items?itemName=Palmmedia.reportgenerator)|.NET Core >=8.0| Add the Azure DevOps extension to your build pipeline.
[Learn more](https://github.com/danielpalme/ReportGenerator/wiki/Integration#azure-devops-extension)|
|[GitHub Actions](https://github.com/marketplace/actions/reportgenerator)|.NET Core >=8.0| Add the GitHub Action to your build pipeline.
[Learn more](https://github.com/danielpalme/ReportGenerator/wiki/Integration#github-actions)|

### Usage / Command line parameters
Use the online [configuration tool](https://reportgenerator.io/usage) to get started quickly.
The more advanced settings are documented in the [wiki](https://github.com/danielpalme/ReportGenerator/wiki/Settings).

```
Parameters:
["]-reports:[;][;]["]
["]-targetdir:["]
[["]-reporttypes:[;]["]]
[["]-sourcedirs:[;][;]["]]
[["]-historydir:["]]
[["]-plugins:[;][;]["]]
[["]-assemblyfilters:<(+|-)filter>[;<(+|-)filter>][;<(+|-)filter>]["]]
[["]-classfilters:<(+|-)filter>[;<(+|-)filter>][;<(+|-)filter>]["]]
[["]-filefilters:<(+|-)filter>[;<(+|-)filter>][;<(+|-)filter>]["]]
[["]-riskhotspotassemblyfilters:<(+|-)filter>[;<(+|-)filter>][;<(+|-)filter>]["]]
[["]-riskhotspotclassfilters:<(+|-)filter>[;<(+|-)filter>][;<(+|-)filter>]["]]
[["]-verbosity:["]]
[["]-title:["]]
[["]-tag:["]]
[["]-license:["]]

Explanations:
Reports: The coverage reports that should be parsed (separated by semicolon).
Globbing is supported.
Target directory: The directory where the generated report should be saved.
Report types: The output formats and scope (separated by semicolon).
Values: Badges, Clover, Cobertura, CsvSummary,
MarkdownSummary, MarkdownAssembliesSummary, MarkdownSummaryGithub, MarkdownDeltaSummary
OpenCover
Html, Html_Light, Html_Dark, Html_BlueRed
HtmlChart, HtmlInline, HtmlSummary, Html_BlueRed_Summary
HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Light, HtmlInline_AzurePipelines_Dark
JsonSummary, CodeClimate, Latex, LatexSummary, lcov, MHtml, SvgChart, SonarQube, TeamCitySummary
TextSummary, TextDeltaSummary
Xml, XmlSummary
Source directories: Optional directories which contain the corresponding source code (separated by semicolon).
The source directories are used if coverage report contains classes without path information.
Globbing is not supported.
History directory: Optional directory for storing persistent coverage information.
Can be used in future reports to show coverage evolution.
Plugins: Optional plugin files for custom reports or custom history storage (separated by semicolon).
Assembly filters: Optional list of assemblies that should be included or excluded in the report.
Class filters: Optional list of classes that should be included or excluded in the report.
File filters: Optional list of files that should be included or excluded in the report.
Risk hotspot assembly filters: Optional list of assemblies that should be included or excluded in the risk hotspots.
Risk hotspot class filters: Optional list of classes that should be included or excluded in the risk hotspots.
Exclusion filters take precedence over inclusion filters.
Wildcards are allowed.
Verbosity: The verbosity level of the log messages.
Values: Verbose, Info, Warning, Error, Off
Title: Optional title.
Tag: Optional tag or build version.
License: Optional license for PRO version. Get your license here: https://reportgenerator.io/pro
License can also be supplied via 'REPORTGENERATOR_LICENSE' environment variable.

Default values:
-reporttypes:Html
-assemblyfilters:+*
-classfilters:+*
-filefilters:+*
-riskhotspotassemblyfilters:+*
-riskhotspotclassfilters:+*
-verbosity:Info

Examples:
"-reports:coverage.xml" "-targetdir:C:\report"
"-reports:target\*\*.xml" "-targetdir:C:\report" -reporttypes:Latex;HtmlSummary -title:IntegrationTest -tag:v1.4.5
"-reports:coverage1.xml;coverage2.xml" "-targetdir:report" "-sourcedirs:C:\MyProject" -plugins:CustomReports.dll
"-reports:coverage.xml" "-targetdir:C:\report" "-assemblyfilters:+Included;-Excluded.*"
```

#### .netconfig support

All the above parameters can also be persisted in a [.netconfig](https://dotnetconfig.org) file, under a `[ReportGenerator]`
section. Examples:

```gitconfig
[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:

```gitconfig
[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](https://dotnetconfig.org) CLI:

```bash
# 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.assemblyfilter
```

Of course it's equally trivial to just edit the `.netconfig` file by hand.

#### MSBuild
A MSBuild task also exists:

```xml









```

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`:

```gitconfig
[ReportGenerator]
reporttypes = "Html;Latex"
targetdirectory = "report"
historydirectory = "history"
assemblyfilters = "+Include;-Excluded"
verbosityLevel = "Verbose"
```

The above target could be simplified as:

```xml






```

## Supported input and output file formats
*ReportGenerator* supports several input and output formats.
The wiki explains the different [output formats](https://github.com/danielpalme/ReportGenerator/wiki/Output-formats) or you can download [sample reports](https://danielpalme.github.io/ReportGenerator/resources/SampleReports.zip) of all supported output formats.
If you need a custom format, you can create a [plugin](https://github.com/danielpalme/ReportGenerator/wiki/Custom-reports).

| **Input formats** | **Output formats** |
|:------------------|:-------------------|
|


  • [OpenCover](https://github.com/OpenCover/opencover) ([Nuget](https://www.nuget.org/packages/OpenCover))
    OpenCover format is also generated by [coverlet](https://github.com/coverlet-coverage/coverlet/) and [altcover](https://github.com/SteveGilham/altcover)

  • [dotCover](https://www.jetbrains.com/dotcover/help/dotCover__Console_Runner_Commands.html) ([Nuget](https://www.nuget.org/packages/JetBrains.dotCover.CommandLineTools/), /ReportType=DetailedXML)

  • Visual Studio ([vstest.console.exe](https://github.com/danielpalme/ReportGenerator/wiki/Visual-Studio-Coverage-Tools#vstestconsoleexe), [CodeCoverage.exe](https://github.com/danielpalme/ReportGenerator/wiki/Visual-Studio-Coverage-Tools#codecoverageexe))

  • [NCover](https://www.ncover.com/info/download) (tested version 1.5.8, other versions may not work)

  • [Cobertura](https://github.com/cobertura/cobertura)

  • [JaCoCo](https://www.jacoco.org/jacoco/index.html) (version 0.8.3 or greater)

  • [Clover](https://openclover.org/)

  • Mono ([mprof-report](https://www.mono-project.com/docs/debug+profile/profile/profiler/#analyzing-the-profile-data))

  • [gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html)

  • [lcov](https://github.com/linux-test-project/lcov)



|

  • Html, Html_Light, Html_Dark, Html_BlueRed, HtmlSummary, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Light, HtmlInline_AzurePipelines_Dark, [MHtml](https://en.wikipedia.org/wiki/MHTML)

  • Clover

  • Cobertura

  • OpenCover ([PRO version](https://reportgenerator.io/pro) only)

  • [SonarQube](https://docs.sonarqube.org/latest/analysis/generic-test)

  • TeamCitySummary

  • [lcov](https://github.com/linux-test-project/lcov)

  • Xml, XmlSummary

  • JsonSummary

  • Latex, LatexSummary

  • TextSummary, TextDeltaSummary

  • CsvSummary

  • MarkdownSummary, MarkdownAssembliesSummary, MarkdownSummaryGithub, MarkdownDeltaSummary

  • SvgChart

  • Badges

  • [Custom reports](https://github.com/danielpalme/ReportGenerator/wiki/Custom-reports)

|

### Screenshots
The screenshots show two snippets of the generated reports:


Screenshot 1


Screenshot 2

**Badges**
Badges in SVG format can be generated if `-reporttypes:Badges` is used:

Example: ![Sample badge](https://danielpalme.github.io/ReportGenerator/resources/badge.svg)

[See all badges](https://reportgenerator.io/resources/reports/Badges/index.html)

## Resources

### Visual Studio extensions
The following extensions exist to visualize coverage in Visual Studio:
| **Name** | **Coverage tool** | **Links** |
|:---------|:------------------|:----------|
| Run Coverlet Report VS2022 | [coverlet](https://github.com/coverlet-coverage/coverlet/) | [GitHub](https://github.com/the-dext/RunCoverletReport)
[Marketplace](https://marketplace.visualstudio.com/items?itemName=ChrisDexter.RunCoverletReportVs2022) |
| FineCodeCoverage | [coverlet](https://github.com/coverlet-coverage/coverlet/), [OpenCover](https://github.com/OpenCover/opencover) | [GitHub](https://github.com/FortuneN/FineCodeCoverage)
[Marketplace](https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage) |

### Links
* https://www.palmmedia.de/Blog/2017/12/6/reportgenerator-new-release-with-risk-hotspots-analysis
* https://www.palmmedia.de/Blog/2016/11/6/reportgenerator-new-release-with-enhanced-html-report-and-cobertura-support
* https://www.palmmedia.de/Blog/2015/1/27/reportgenerator-new-beta-with-historytrend-charts
* https://www.palmmedia.de/Blog/2012/4/29/reportgenerator-new-release-with-more-advanced-report-preprocessing

### Download statistics
![Nuget](https://img.shields.io/nuget/dt/ReportGenerator.svg?label=ReportGenerator%40nuget&style=for-the-badge)
![Nuget](https://img.shields.io/nuget/dt/dotnet-reportgenerator-globaltool.svg?label=dotnet-reportgenerator-globaltool%40nuget&style=for-the-badge)
![Nuget](https://img.shields.io/nuget/dt/ReportGenerator.Core.svg?label=ReportGenerator.Core%40nuget&style=for-the-badge)

![Visual Studio Marketplace Installs - Azure DevOps Extension](https://img.shields.io/visual-studio-marketplace/azure-devops/installs/total/Palmmedia.reportgenerator.svg?label=Azure%20DevOps&style=for-the-badge)
![GitHub All Releases](https://img.shields.io/github/downloads/danielpalme/ReportGenerator/total.svg?label=GitHub&style=for-the-badge)
![Chocolatey](https://img.shields.io/chocolatey/dt/reportgenerator.portable.svg?label=Chocolatey&style=for-the-badge)

### Trends
[Nuget downloads](https://nugettrends.com/packages?months=24&ids=ReportGenerator&ids=dotnet-reportgenerator-globaltool&ids=ReportGenerator.Core&ids=dotnet-reportgenerator-cli)
[GitHub stars](https://star-history.t9t.io/#danielpalme/ReportGenerator)

## Contact

Author: Daniel Palme
Blog: [www.palmmedia.de](https://www.palmmedia.de)
Twitter: [@danielpalme](https://twitter.com/danielpalme)