coverlet-dev - coverlet.collector 1.2.2-g3ca6223691

Coverlet is a cross platform code coverage library for .NET, with support for line, branch and method coverage.

PM> Install-Package coverlet.collector -Version 1.2.2-g3ca6223691 -Source https://www.myget.org/F/coverlet-dev/api/v3/index.json

Copy to clipboard

> nuget.exe install coverlet.collector -Version 1.2.2-g3ca6223691 -Source https://www.myget.org/F/coverlet-dev/api/v3/index.json

Copy to clipboard

> dotnet add package coverlet.collector --version 1.2.2-g3ca6223691 --source https://www.myget.org/F/coverlet-dev/api/v3/index.json

Copy to clipboard
<PackageReference Include="coverlet.collector" Version="1.2.2-g3ca6223691" />
Copy to clipboard
source https://www.myget.org/F/coverlet-dev/api/v3/index.json

nuget coverlet.collector  ~> 1.2.2-g3ca6223691
Copy to clipboard

> choco install coverlet.collector --version 1.2.2-g3ca6223691 --source https://www.myget.org/F/coverlet-dev/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "coverlet-dev" -SourceLocation "https://www.myget.org/F/coverlet-dev/api/v2"
Install-Module -Name "coverlet.collector" -RequiredVersion "1.2.2-g3ca6223691" -Repository "coverlet-dev" -AllowPreRelease
Copy to clipboard

Coverlet

Build Status Code%20Coverage License: MIT

Driver Current version Downloads
coverlet.collector NuGet NuGet
coverlet.msbuild NuGet NuGet
coverlet.console NuGet NuGet

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.

Coverlet documentation reflect the current repository state of the features, not the released ones. Check the changelog to understand if the documented feature you want to use has been officially released.

Main contents

Quick Start

Coverlet can be used through three different drivers

  • VSTest engine integration
  • MSBuild task integration
  • As a .NET Global tool (supports standalone integration tests)

Coverlet supports only SDK-style projects https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2019

VSTest Integration (preferred due to known issue)

Installation (coverlet.collector)

dotnet add package coverlet.collector

N.B. You MUST add package only to test projects and if you create xunit test projects (dotnet new xunit) you'll find the reference already present in csproj file because Coverlet is the default coverage tool for every .NET Core and >= .NET 6 applications, you've only to update to last version if needed. Do not add coverlet.collector and coverlet.msbuild package in a test project.

Usage (coverlet.collector)

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.xml file containing the results will be published to the TestResults directory as an attachment.

See documentation for advanced usage.

Requirements (coverlet.collector)

  • You need to be running .NET 6.0 SDK v6.0.316 or newer
  • You need to reference version 17.5.0 and above of Microsoft.NET.Test.Sdk
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />

MSBuild Integration (suffers of possible known issue)

Installation (coverlet.msbuild)

dotnet add package coverlet.msbuild

N.B. Typically you MUST add package only to test projects. Do not add coverlet.msbuild and coverlet.collector package in a test project.

Usage (coverlet.msbuild)

Coverlet also integrates with the build system to run code coverage after tests. Enabling code coverage is as simple as setting the CollectCoverage property to true

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.

See documentation for advanced usage.

Requirements (coverlet.msbuild)

Requires a runtime that support .NET Standard 2.0 and above

.NET Global Tool (guide, suffers from possible known issue)

Installation (coverlet.console)

dotnet tool install --global coverlet.console

Usage (coverlet.console)

The coverlet tool is invoked by specifying the path to the assembly that contains the unit tests. You also need to specify the test runner and the arguments to pass to the test runner using the --target and --targetargs options respectively. The invocation of the test runner with the supplied arguments must not involve a recompilation of the unit test assembly or no coverage result will be generated.

The following example shows how to use the familiar dotnet test toolchain:

coverlet /path/to/test-assembly.dll --target "dotnet" --targetargs "test /path/to/test-project --no-build"

Note: The --no-build flag is specified so that the /path/to/test-assembly.dll assembly isn't rebuilt

See documentation for advanced usage.

Requirements (coverlet.console)

.NET global tools rely on a .NET Core runtime installed on your machine https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools#what-could-go-wrong

.NET Coverlet global tool requires .NET Core 2.2 and above

How It Works

Coverlet generates code coverage information by going through the following process:

Before Tests Run

  • Locates 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.

Deterministic build support

Coverlet supports coverage for deterministic builds. The solution at the moment is not optimal and need a workaround. Take a look at documentation.

Are you in trouble with some feature? Check on examples!

Known Issues

Unfortunately we have some known issues, check it here

Cake Add-In

If you're using Cake Build for your build script you can use the Cake.Coverlet add-in to provide you extensions to dotnet test for passing Coverlet arguments in a strongly typed manner.

Visual Studio Add-In

If you want to visualize coverlet output inside Visual Studio while you code, you can use the following addins depending on your platform.

Windows

If you're using Visual Studio on Windows, you can use the Fine Code Coverage extension. Visualization is updated when you run unit tests inside Visual Studio.

Mac OS

If you're using Visual Studio for Mac, you can use the VSMac-CodeCoverage extension.

Consume nightly build

We offer nightly build of master for all packages. See the documentation

Issues & Contributions

If you find a bug or have a feature request, please report them at this repository's issues section. See the CONTRIBUTING GUIDE for details on building and contributing to this project.

Coverlet Team

Author and owner

Co-maintainers

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.

For more information, see the .NET Foundation Code of Conduct.

Credits

Part of the code is based on work done by OpenCover team https://github.com/OpenCover

License

This project is licensed under the MIT license. See the LICENSE file for more info.

Supported by the .NET Foundation

  • .NETStandard 1.0: 1.0.0.0

Owners

Toni Solarin-Sodara

Authors

tonerdo

Project URL

http://github.com/tonerdo/coverlet

License

Unknown

Tags

coverage testing unit-test lcov opencover quality

Info

4850 total downloads
2 downloads for version 1.2.2-g3ca6223691
Download (757.34 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.3.1-preview.27.gdd2237a3be 779.85 KB Fri, 11 Sep 2020 00:04:46 GMT 652
1.3.1-preview.26.g521f3d306e 779.86 KB Sun, 06 Sep 2020 00:06:27 GMT 40
1.3.1-preview.24.g6479f627e4 772.38 KB Thu, 27 Aug 2020 00:05:59 GMT 108
1.3.1-preview.23.g2cfe8ea110 764.05 KB Tue, 04 Aug 2020 00:04:42 GMT 395
1.3.1-preview.21.g778b697655 763.71 KB Fri, 24 Jul 2020 00:05:02 GMT 2
1.3.1-preview.20.g77b6c08c64 763.71 KB Tue, 21 Jul 2020 00:04:47 GMT 2
1.3.1-preview.19.ge99520eb06 763.7 KB Tue, 14 Jul 2020 00:04:56 GMT 2
1.3.1-preview.18.gfe977b6c59 763.72 KB Mon, 13 Jul 2020 00:06:52 GMT 2
1.3.1-preview.17.g7385f59e17 763.7 KB Sun, 12 Jul 2020 00:05:30 GMT 4
1.3.1-preview.13.g7c12e15963 763.27 KB Thu, 09 Jul 2020 00:04:48 GMT 2
1.3.1-preview.12.g822cb6683c 763.28 KB Sat, 27 Jun 2020 00:04:21 GMT 3
1.3.1-preview.10.gf7c3fd4e3a 763.32 KB Sun, 14 Jun 2020 00:04:07 GMT 2
1.3.1-preview.8.ge848786b0d 762.52 KB Mon, 08 Jun 2020 00:07:15 GMT 131
1.3.1-preview.6.g8468bcf36c 762.51 KB Sun, 07 Jun 2020 00:07:24 GMT 2
1.3.1-preview.5.g4974550fa6 762.49 KB Fri, 05 Jun 2020 00:03:06 GMT 1
1.3.1-preview.3.gade9498891 762.23 KB Thu, 04 Jun 2020 00:05:08 GMT 2
1.3.1-preview.2.g4fcf22dff2 762.24 KB Sun, 31 May 2020 00:02:52 GMT 2
1.3.0-preview-0001-gfa138c0e00 761.94 KB Sun, 12 Apr 2020 00:04:25 GMT 40
1.3.0-preview.23.ge438dbf568 762.25 KB Fri, 29 May 2020 00:04:43 GMT 2
1.3.0-preview.22.gfb1124cd3d 762.25 KB Mon, 25 May 2020 00:03:58 GMT 14
1.3.0-preview.20.g180bee479f 762.23 KB Tue, 19 May 2020 00:04:34 GMT 3
1.3.0-preview.18.g8a1026dd2b 761.92 KB Sat, 16 May 2020 00:05:46 GMT 1
1.3.0-preview.17.g3c55332cce 761.92 KB Mon, 11 May 2020 00:08:42 GMT 4
1.3.0-preview.13.ge1ec1cce8c 762 KB Fri, 08 May 2020 00:04:34 GMT 2
1.3.0-preview.10.gb9ebbc6541 761.98 KB Sun, 03 May 2020 00:03:56 GMT 2
1.3.0-preview.9.g882b4c87b7 762 KB Sat, 02 May 2020 00:03:55 GMT 12
1.3.0-preview.8.g4e9deb5576 761.99 KB Mon, 20 Apr 2020 00:05:07 GMT 15
1.3.0-preview.7.g2e2b578fcc 762.01 KB Sun, 19 Apr 2020 00:04:27 GMT 2
1.3.0-preview.6.ga0e22ec622 761.99 KB Sat, 18 Apr 2020 00:05:08 GMT 232
1.3.0-preview.4.gf83cd9e0a7 761.96 KB Tue, 14 Apr 2020 00:05:30 GMT 2
1.2.46-g3f81828821 759.14 KB Tue, 31 Mar 2020 00:04:16 GMT 355
1.2.45-g4c1cdf9ee9 759.14 KB Thu, 26 Mar 2020 00:05:08 GMT 20
1.2.44-gcd945985d8 759.11 KB Mon, 23 Mar 2020 00:02:43 GMT 3
1.2.41-g8ddbb6ff3c 757.74 KB Sun, 22 Mar 2020 00:02:35 GMT 2
1.2.40-g0cc2548b27 757.74 KB Wed, 18 Mar 2020 00:02:53 GMT 1
1.2.38-g34d6dc5ff6 757.75 KB Sat, 14 Mar 2020 00:02:39 GMT 4
1.2.37-g39e9b1036a 757.59 KB Wed, 11 Mar 2020 00:03:03 GMT 2
1.2.36-g54e576f75d 757.34 KB Sun, 01 Mar 2020 00:02:28 GMT 4
1.2.35-g830ad8a572 757.32 KB Sat, 29 Feb 2020 00:02:27 GMT 2
1.2.33-g84dcfdb7b4 757.32 KB Mon, 24 Feb 2020 00:02:47 GMT 133
1.2.32-gfd1030f8c2 757.31 KB Sun, 23 Feb 2020 00:02:53 GMT 2
1.2.31-gbcd754a70e 757.33 KB Thu, 20 Feb 2020 00:02:28 GMT 528
1.2.30-g650d4cf4a3 757.33 KB Wed, 19 Feb 2020 00:02:29 GMT 2
1.2.29-gd2f0fd2248 757.33 KB Mon, 17 Feb 2020 00:02:23 GMT 3
1.2.28-g7f292f9fbf 757.28 KB Thu, 06 Feb 2020 00:02:42 GMT 27
1.2.27-gfd68090b0a 766.81 KB Wed, 05 Feb 2020 00:02:22 GMT 2
1.2.26-g8b5096f15e 766.8 KB Thu, 30 Jan 2020 00:06:03 GMT 1
1.2.25-g074a201a91 766.8 KB Wed, 29 Jan 2020 00:02:31 GMT 128
1.2.22-gc314586a64 766.68 KB Tue, 28 Jan 2020 00:02:26 GMT 18
1.2.20-ga2b0373d60 766.65 KB Mon, 27 Jan 2020 08:41:01 GMT 4
1.2.6-g8cb1ebc0da 757.33 KB Sun, 12 Jan 2020 00:02:37 GMT 2
1.2.4-gbd2f1841a5 757.33 KB Thu, 09 Jan 2020 00:05:36 GMT 2
1.2.3-g7080820b21 757.34 KB Mon, 06 Jan 2020 00:02:42 GMT 3
1.2.2-g3ca6223691 757.34 KB Sat, 04 Jan 2020 00:02:33 GMT 2
1.2.1-ge9dcf4c56a 759.12 KB Tue, 07 Apr 2020 00:04:45 GMT 2
1.2.1-g83aa10e32b 759.12 KB Fri, 03 Apr 2020 00:04:32 GMT 2
1.2.1-g7de6209cc6 759.11 KB Sun, 05 Apr 2020 00:04:06 GMT 2
1.2.1-g62ff6d7c2c 759.12 KB Mon, 06 Apr 2020 00:04:14 GMT 2
1.2.1-g51151d69b2 761.89 KB Fri, 10 Apr 2020 00:04:11 GMT 2
1.2.1-g4e177f0c57 761.87 KB Thu, 09 Apr 2020 17:20:14 GMT 5
1.2.1-g0c24f74a27 759.11 KB Sat, 04 Apr 2020 00:03:56 GMT 2
1.1.55-g0f031e29c2 757.34 KB Tue, 24 Dec 2019 00:02:38 GMT 3
1.1.54-g81daeb8959 757.34 KB Sun, 22 Dec 2019 00:02:41 GMT 2
1.1.52-g5f997cea13 756.51 KB Sat, 21 Dec 2019 00:02:41 GMT 2
1.1.50-g7cad9b3f58 756.3 KB Sat, 14 Dec 2019 00:02:32 GMT 12
1.1.49-ge15e653492 756.3 KB Fri, 13 Dec 2019 00:06:42 GMT 3
1.1.48-g45d8d4ee42 756.31 KB Tue, 10 Dec 2019 00:02:49 GMT 2
1.1.47-g6336e5811e 756.29 KB Mon, 09 Dec 2019 00:02:46 GMT 2
1.1.45-gca10ca949d 755.69 KB Sun, 08 Dec 2019 00:02:36 GMT 2
1.1.38-g53562c6460 755.57 KB Sat, 07 Dec 2019 00:02:51 GMT 2
1.1.37-g59ca277294 755.39 KB Thu, 05 Dec 2019 00:02:47 GMT 2
1.1.36-gb1837af930 755.4 KB Wed, 04 Dec 2019 00:02:41 GMT 2
1.1.30-g63dbda8190 709.81 KB Sat, 30 Nov 2019 00:02:38 GMT 2
1.1.29-ga23c3a3d0e 707.95 KB Fri, 29 Nov 2019 00:02:48 GMT 2
1.1.27-ge123f6b54a 707.93 KB Sat, 23 Nov 2019 00:02:39 GMT 2
1.1.26-g4d9f3cac3b 707.94 KB Wed, 13 Nov 2019 00:05:01 GMT 2
1.1.24-g180c8a69f2 707.94 KB Sat, 09 Nov 2019 00:02:45 GMT 1
1.1.21-g6630c0acce 707.94 KB Thu, 07 Nov 2019 00:05:43 GMT 2
1.1.20-g4f3f25fda9 706.85 KB Thu, 31 Oct 2019 00:03:55 GMT 3
1.1.19-g545b8fc912 706.91 KB Wed, 23 Oct 2019 00:03:10 GMT 3
1.1.18-gfd17f4be6e 706.76 KB Wed, 16 Oct 2019 00:03:10 GMT 3
1.1.17-gd245f470a3 706.79 KB Tue, 15 Oct 2019 00:03:04 GMT 2
1.1.16-g2a90a1c9c7 706.77 KB Sun, 13 Oct 2019 00:02:53 GMT 3
1.1.14-g207f346bee 706.5 KB Sat, 12 Oct 2019 00:02:59 GMT 3
1.1.12-gf3cce5ded8 706.5 KB Thu, 10 Oct 2019 00:03:14 GMT 2
1.1.11-g9321bd7ad2 704.95 KB Wed, 09 Oct 2019 00:02:58 GMT 2
1.1.10-g026c74a5bd 704.97 KB Sun, 06 Oct 2019 00:02:50 GMT 2
1.1.9-g0614f871bc 704.95 KB Tue, 01 Oct 2019 00:03:02 GMT 2
1.1.8-g589e210e74 704.81 KB Fri, 27 Sep 2019 00:03:01 GMT 13
1.1.7-g213b927ac7 704.8 KB Tue, 24 Sep 2019 00:03:04 GMT 2
1.1.1-g4ca01eb239 704.96 KB Mon, 23 Sep 2019 00:03:04 GMT 2
1.0.82-gf24b9d567c 704.95 KB Sun, 22 Sep 2019 00:02:41 GMT 2
1.0.80-g82a920864a 704.61 KB Fri, 20 Sep 2019 00:02:59 GMT 2
1.0.79-g2aa8ed683c 704.52 KB Wed, 18 Sep 2019 00:03:00 GMT 2
1.0.78-g903f61b6de 704.51 KB Tue, 17 Sep 2019 00:03:01 GMT 2
1.0.69-gafe227b39e 701.58 KB Sat, 07 Sep 2019 00:02:49 GMT 20
1.0.68-g75520ddc5f 701.98 KB Thu, 05 Sep 2019 00:02:58 GMT 2
1.0.66-g15eeb98f5d 701.91 KB Wed, 28 Aug 2019 19:08:07 GMT 2
1.0.65-g70b3ef31da 701.95 KB Wed, 21 Aug 2019 00:03:01 GMT 2
1.0.64-g428034d46a 701.96 KB Fri, 16 Aug 2019 00:02:52 GMT 1
1.0.63-g4e02ab0a27 701.95 KB Thu, 15 Aug 2019 00:02:52 GMT 2
1.0.61-g872e087e6a 701.29 KB Tue, 13 Aug 2019 00:03:06 GMT 2
1.0.59-gcca16685ed 701.32 KB Sat, 10 Aug 2019 00:02:48 GMT 2
1.0.58-gda509492a0 654.41 KB Fri, 09 Aug 2019 00:03:03 GMT 2
1.0.56-g83e93db6d8 654.39 KB Sun, 04 Aug 2019 00:03:37 GMT 2
1.0.55-g55c866f142 654.39 KB Thu, 01 Aug 2019 00:03:02 GMT 3
1.0.54-g49ec4b9703 652.55 KB Sun, 28 Jul 2019 00:02:50 GMT 2
1.0.53-g4d61d296e3 652.54 KB Sat, 27 Jul 2019 08:19:11 GMT 1
1.0.52-g84d47a144c 652.53 KB Fri, 26 Jul 2019 00:02:43 GMT 6
1.0.51-ged9195d73b 652.55 KB Thu, 25 Jul 2019 00:03:06 GMT 2
1.0.49-ge3d1a6c9df 652.5 KB Wed, 24 Jul 2019 00:02:57 GMT 2
1.0.47-g016c3630ca 652.49 KB Wed, 17 Jul 2019 03:20:47 GMT 3
1.0.46-ga339983da4 652.47 KB Mon, 15 Jul 2019 12:42:37 GMT 2
1.0.45-gec04c7d82f 652.46 KB Thu, 04 Jul 2019 08:31:19 GMT 2
1.0.44-ge159335949 652.19 KB Mon, 01 Jul 2019 00:03:06 GMT 1
1.0.41-g53a3242437 652.21 KB Fri, 28 Jun 2019 00:02:55 GMT 3
1.0.40-gd5d0a0b59c 633.45 KB Sat, 22 Jun 2019 05:16:33 GMT 2
1.0.39-gf14ee2b7fb 633.44 KB Tue, 18 Jun 2019 00:03:00 GMT 2
1.0.37-g2bbe53f6e0 685.21 KB Mon, 17 Jun 2019 01:35:06 GMT 2
1.0.36-gcc60b0dba7 685.21 KB Sun, 16 Jun 2019 00:03:04 GMT 2
1.0.33-g66a0119867 685.22 KB Tue, 11 Jun 2019 00:02:49 GMT 3
1.0.31-g0f85b3ce80 685.17 KB Sat, 08 Jun 2019 00:02:49 GMT 2
1.0.25-g6209239d69 633.63 KB Mon, 03 Jun 2019 00:02:44 GMT 1
1.0.24-ge5998d8fbd 633.63 KB Sat, 01 Jun 2019 00:02:51 GMT 3
1.0.0-gbaad0091a5 633.52 KB Mon, 27 May 2019 00:11:02 GMT 6
1.0.0-gb8abd2b9a3 633.52 KB Tue, 28 May 2019 00:03:14 GMT 3
1.0.0-g7806f43ae7 633.54 KB Mon, 27 May 2019 00:27:22 GMT 2
1.0.0-g5a139b200f 633.61 KB Thu, 30 May 2019 00:02:56 GMT 6
1.0.0-g2905b634fc 633.53 KB Mon, 27 May 2019 00:21:58 GMT 2
1.0.0-g24d5acafc6 685.16 KB Fri, 07 Jun 2019 00:03:17 GMT 2
1.0.0-g2150873b65 633.53 KB Mon, 27 May 2019 00:14:37 GMT 2
1.0.0-g0f6cf3fc85 633.52 KB Sun, 26 May 2019 23:56:38 GMT 2
1.0.0-g0dd56242f2 633.6 KB Wed, 29 May 2019 00:03:08 GMT 2
1.0.0-g02708bbaea 633.52 KB Mon, 27 May 2019 00:02:55 GMT 1697