Coverlet
Coverlet is a cross platform code coverage framework for .NET, with support for line, branch and method coverage. It works with .NET Framework on Windows and .NET Core on all supported platforms.
Installation
VSTest Integration:
dotnet add package coverlet.collector
N.B. You MUST add package only to test projects
MSBuild Integration:
dotnet add package coverlet.msbuild
N.B. You MUST add package only to test projects
Global Tool:
dotnet tool install --global coverlet.console
Quick Start
VSTest Integration
Coverlet is integrated into the Visual Studio Test Platform as a data collector. To get coverage simply run the following command:
dotnet test --collect:"XPlat Code Coverage"
After the above command is run, a coverage.cobertura.json
file containing the results will be published to the TestResults
directory as an attachment. A summary of the results will also be displayed in the terminal.
See documentation for advanced usage.
Requirements
- You needโฆ