See the version list below for details.
Install-Package coverlet.msbuild -Version 1.0.0
dotnet add package coverlet.msbuild --version 1.0.0
<PackageReference Include="coverlet.msbuild" Version="1.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add coverlet.msbuild --version 1.0.0
#r "nuget: coverlet.msbuild, 1.0.0"
// Install coverlet.msbuild as a Cake Addin #addin nuget:?package=coverlet.msbuild&version=1.0.0 // Install coverlet.msbuild as a Cake Tool #tool nuget:?package=coverlet.msbuild&version=1.0.0
Coverlet is a cross platform code coverage library for .NET Core, with support for line and method coverage.
Available on NuGet
PM> Install-Package coverlet.msbuild
.NET Core CLI:
dotnet add package coverlet.msbuild
How It Works
Coverlet integrates with the MSBuild system and that allows it to go through the following process:
Before Tests Run
- Locate the unit test assembly and selects all the referenced assemblies that have PDBs.
- Instruments the selected assemblies by inserting code to record sequence point hits to a temporary file.
After Tests Run
- Restore the original non-instrumented assembly files.
- Read the recorded hits information from the temporary file.
- Generate the coverage result from the hits information and write it to a file.
Coverlet deosn't require any additional setup other than including the NuGet package. It integrates with the
dotnet test infrastructure built into the .NET Core CLI and when enabled will automatically generate coverage results after tests are run.
Enabling code coverage is as simple as setting the
CollectCoverage property to
dotnet test /p:CollectCoverage=true
After the above command is run, a
coverage.json file containing the results will be generated in the root directory of the test project. A summary of the results will also be displayed in the terminal.
Coverlet can generate coverage results in multiple formats, which is specified using the
CoverletOutputFormat property. Possible values include
opencover. For example, the following command emits coverage results in the opencover format:
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
The output folder of the coverage result file can also be specified using the
- Branch coverage
- Console runner (removes the need for requiring a NuGet package)
Issues & Contributions
If you find a bug or have a feature request, please report them at this repository's issues section. Contributions are highly welcome, however, except for very small changes, kindly file an issue and let's have a discussion before you open a pull request.
This project is licensed under the MIT license. See the LICENSE file for more info.
This package has no dependencies.
NuGet packages (13)
Showing the top 5 NuGet packages that depend on coverlet.msbuild:
Simple to use CQRS library.
A logging decorator for the Klinked.Cqrs library that makes it easy to add logging to all commands, events, and queries.
A simple library aimed at bringing Gherkin style tests to xUnit. Usage of the library is similar to SpecFlow.
GitHub repositories (176)
Showing the top 5 popular GitHub repositories that depend on coverlet.msbuild:
ML.NET is an open source and cross-platform machine learning framework for .NET.
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
API Support for your favorite torrent trackers
GraphQL for .NET
Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.