coverlet-dev - coverlet.console 1.7.29-gd2f0fd2248

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

PM> Install-Package coverlet.console -Version 1.7.29-gd2f0fd2248 -Source https://www.myget.org/F/coverlet-dev/api/v3/index.json

Copy to clipboard

> nuget.exe install coverlet.console -Version 1.7.29-gd2f0fd2248 -Source https://www.myget.org/F/coverlet-dev/api/v3/index.json

Copy to clipboard

> dotnet add package coverlet.console --version 1.7.29-gd2f0fd2248 --source https://www.myget.org/F/coverlet-dev/api/v3/index.json

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

nuget coverlet.console  ~> 1.7.29-gd2f0fd2248
Copy to clipboard

> choco install coverlet.console --version 1.7.29-gd2f0fd2248 --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.console" -RequiredVersion "1.7.29-gd2f0fd2248" -Repository "coverlet-dev" -AllowPreRelease
Copy to clipboard

Coverlet

Build Status Code%20Coverage License: MIT

Driver Current version Downloads
coverlet.MTP NuGet NuGet
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.

[!NOTE] Coverlet only supports modern .NET SDK-style projects.

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 four different drivers

  • VSTest engine integration
  • MSBuild task integration
  • As a .NET Global tool (supports standalone integration tests)
  • New Microsoft Testing Platform integration (coverlet.MTP)

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

NEW Microsoft Testing Platform Integration (coverlet.MTP)

Installation (coverlet.MTP)

dotnet add package coverlet.MTP

[!NOTE] Add the coverlet.MTP package only to test projects that use the Microsoft Testing Platform. This package is designed for projects using Microsoft.Testing.Platform (MTP) as the test runner, not the traditional VSTest runner.

Usage (coverlet.MTP)

Coverlet integrates with the Microsoft Testing Platform as an extension. To enable coverage collection, run your tests with the --coverlet flag:

dotnet run --project <your-test-project> -- --coverlet

Or when using dotnet test with MTP-enabled projects:

dotnet test --coverlet

After the above command is run, coverage report files will be generated in the test results directory. By default, reports are generated in json and cobertura formats.

Additional Options (coverlet.MTP)

Option Description
--coverlet Enable code coverage data collection
--coverlet-output-format Output format(s) for coverage report (json, lcov, opencover, cobertura)
--coverlet-include Include assemblies matching filters (e.g., [Assembly]Type)
--coverlet-exclude Exclude assemblies matching filters (e.g., [Assembly]Type)
--coverlet-include-test-assembly Include test assembly in coverage

Example with options:

dotnet run --project <your-test-project> -- --coverlet --coverlet-output-format cobertura --coverlet-exclude "[xunit.]"

Requirements (coverlet.MTP)

VSTest Integration (preferred due to known issue)

Installation (coverlet.collector)

dotnet add package coverlet.collector

[!NOTE] You MUST add package only to test projects and if you create xunit test projects (dotnet new xunit) you will find the reference already present in csproj file because Coverlet is the default coverage tool for every .NET Core and >= .NET 8 applications, you've only to update to last version if needed. Add coverlet.collector OR 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)

  • .NET 8.0 SDK is required (version 8.0.112 or higher)
  • Microsoft.NET.Test.Sdk version 17.12.0 or higher
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.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)

  • .NET 8.0 SDK is required (version 8.0.112 or higher)
  • .NET Framework that supports .NET Standard 2.0

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

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

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

  • .NETCoreApp 2.2: 2.2.0.0

Owners

Toni Solarin-Sodara

Authors

tonerdo

Project URL

https://github.com/tonerdo/coverlet

License

Unknown

Tags

coverage testing unit-test lcov opencover quality

Info

50829 total downloads
64 downloads for version 1.7.29-gd2f0fd2248
Download (659.83 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.7.46-g3f81828821 661.45 KB Tue, 31 Mar 2020 00:04:17 GMT 84
1.7.45-g4c1cdf9ee9 661.46 KB Thu, 26 Mar 2020 00:05:09 GMT 86
1.7.44-gcd945985d8 661.44 KB Mon, 23 Mar 2020 00:02:44 GMT 78
1.7.41-g8ddbb6ff3c 660.06 KB Sun, 22 Mar 2020 00:02:36 GMT 79
1.7.40-g0cc2548b27 660.05 KB Wed, 18 Mar 2020 00:02:54 GMT 76
1.7.38-g34d6dc5ff6 660.05 KB Sat, 14 Mar 2020 00:02:40 GMT 77
1.7.37-g39e9b1036a 660.1 KB Wed, 11 Mar 2020 00:03:04 GMT 79
1.7.36-g54e576f75d 659.84 KB Sun, 01 Mar 2020 00:02:29 GMT 76
1.7.35-g830ad8a572 659.81 KB Sat, 29 Feb 2020 00:02:28 GMT 74
1.7.33-g84dcfdb7b4 659.83 KB Mon, 24 Feb 2020 00:02:48 GMT 81
1.7.32-gfd1030f8c2 659.81 KB Sun, 23 Feb 2020 00:02:53 GMT 83
1.7.31-gbcd754a70e 659.82 KB Thu, 20 Feb 2020 00:02:28 GMT 84
1.7.30-g650d4cf4a3 659.82 KB Wed, 19 Feb 2020 00:02:30 GMT 68
1.7.29-gd2f0fd2248 659.83 KB Mon, 17 Feb 2020 00:02:23 GMT 64
1.7.28-g7f292f9fbf 659.84 KB Thu, 06 Feb 2020 00:02:43 GMT 80
1.7.27-gfd68090b0a 659.82 KB Wed, 05 Feb 2020 00:02:23 GMT 70
1.7.26-g8b5096f15e 659.82 KB Thu, 30 Jan 2020 00:06:04 GMT 68
1.7.25-g074a201a91 659.82 KB Wed, 29 Jan 2020 00:02:32 GMT 68
1.7.22-gc314586a64 659.7 KB Tue, 28 Jan 2020 00:02:27 GMT 71
1.7.20-ga2b0373d60 659.67 KB Mon, 27 Jan 2020 08:41:02 GMT 67
1.7.6-g8cb1ebc0da 650.04 KB Sun, 12 Jan 2020 00:02:38 GMT 56
1.7.4-gbd2f1841a5 650.04 KB Thu, 09 Jan 2020 00:05:37 GMT 62
1.7.3-preview.27.gdd2237a3be 681.36 KB Fri, 11 Sep 2020 00:04:47 GMT 67
1.7.3-preview.26.g521f3d306e 681.37 KB Sun, 06 Sep 2020 00:06:28 GMT 75
1.7.3-preview.24.g6479f627e4 674.03 KB Thu, 27 Aug 2020 00:06:01 GMT 69
1.7.3-preview.23.g2cfe8ea110 665.71 KB Tue, 04 Aug 2020 00:04:43 GMT 60
1.7.3-preview.21.g778b697655 665.44 KB Fri, 24 Jul 2020 00:05:03 GMT 81
1.7.3-preview.20.g77b6c08c64 665.44 KB Tue, 21 Jul 2020 00:04:48 GMT 71
1.7.3-preview.19.ge99520eb06 665.44 KB Tue, 14 Jul 2020 00:04:57 GMT 80
1.7.3-preview.18.gfe977b6c59 665.44 KB Mon, 13 Jul 2020 00:06:53 GMT 78
1.7.3-preview.17.g7385f59e17 665.42 KB Sun, 12 Jul 2020 00:05:31 GMT 78
1.7.3-preview.13.g7c12e15963 665 KB Thu, 09 Jul 2020 00:04:48 GMT 75
1.7.3-preview.12.g822cb6683c 665.03 KB Sat, 27 Jun 2020 00:04:22 GMT 75
1.7.3-preview.10.gf7c3fd4e3a 665.04 KB Sun, 14 Jun 2020 00:04:08 GMT 76
1.7.3-preview.8.ge848786b0d 664.26 KB Mon, 08 Jun 2020 00:07:16 GMT 74
1.7.3-preview.6.g8468bcf36c 664.25 KB Sun, 07 Jun 2020 00:07:25 GMT 71
1.7.3-preview.5.g4974550fa6 664.23 KB Fri, 05 Jun 2020 00:03:08 GMT 82
1.7.3-preview.3.gade9498891 664.03 KB Thu, 04 Jun 2020 00:05:09 GMT 64
1.7.3-preview.2.g4fcf22dff2 664.04 KB Sun, 31 May 2020 00:02:53 GMT 85
1.7.3-g7080820b21 650.05 KB Mon, 06 Jan 2020 00:02:42 GMT 70
1.7.2-preview-0001-gfa138c0e00 663.84 KB Sun, 12 Apr 2020 00:04:26 GMT 74
1.7.2-preview.23.ge438dbf568 664.06 KB Fri, 29 May 2020 00:04:44 GMT 74
1.7.2-preview.22.gfb1124cd3d 664.06 KB Mon, 25 May 2020 00:03:59 GMT 75
1.7.2-preview.20.g180bee479f 664.03 KB Tue, 19 May 2020 00:04:35 GMT 71
1.7.2-preview.18.g8a1026dd2b 663.72 KB Sat, 16 May 2020 00:05:46 GMT 73
1.7.2-preview.17.g3c55332cce 663.71 KB Mon, 11 May 2020 00:08:42 GMT 77
1.7.2-preview.13.ge1ec1cce8c 663.85 KB Fri, 08 May 2020 00:04:35 GMT 77
1.7.2-preview.10.gb9ebbc6541 663.84 KB Sun, 03 May 2020 00:03:57 GMT 72
1.7.2-preview.9.g882b4c87b7 663.84 KB Sat, 02 May 2020 00:03:56 GMT 78
1.7.2-preview.8.g4e9deb5576 663.84 KB Mon, 20 Apr 2020 00:05:07 GMT 75
1.7.2-preview.7.g2e2b578fcc 663.84 KB Sun, 19 Apr 2020 00:04:28 GMT 69
1.7.2-preview.6.ga0e22ec622 663.84 KB Sat, 18 Apr 2020 00:05:09 GMT 69
1.7.2-preview.4.gf83cd9e0a7 663.86 KB Tue, 14 Apr 2020 00:05:31 GMT 77
1.7.2-g3ca6223691 650.05 KB Sat, 04 Jan 2020 00:02:34 GMT 66
1.7.1-ge9dcf4c56a 661.42 KB Tue, 07 Apr 2020 00:04:47 GMT 64
1.7.1-g83aa10e32b 661.42 KB Fri, 03 Apr 2020 00:04:33 GMT 52
1.7.1-g7de6209cc6 661.41 KB Sun, 05 Apr 2020 00:04:07 GMT 67
1.7.1-g62ff6d7c2c 661.42 KB Mon, 06 Apr 2020 00:04:14 GMT 78
1.7.1-g51151d69b2 663.79 KB Fri, 10 Apr 2020 00:04:12 GMT 72
1.7.1-g4e177f0c57 663.76 KB Thu, 09 Apr 2020 17:20:15 GMT 61
1.7.1-g0c24f74a27 661.4 KB Sat, 04 Apr 2020 00:03:57 GMT 72
1.6.55-g0f031e29c2 650.05 KB Tue, 24 Dec 2019 00:02:39 GMT 87
1.6.54-g81daeb8959 650.07 KB Sun, 22 Dec 2019 00:02:42 GMT 63
1.6.52-g5f997cea13 649.24 KB Sat, 21 Dec 2019 00:02:43 GMT 71
1.6.50-g7cad9b3f58 649.24 KB Sat, 14 Dec 2019 00:02:33 GMT 65
1.6.49-ge15e653492 649.25 KB Fri, 13 Dec 2019 00:06:43 GMT 84
1.6.48-g45d8d4ee42 649.25 KB Tue, 10 Dec 2019 00:02:49 GMT 65
1.6.47-g6336e5811e 649.23 KB Mon, 09 Dec 2019 00:02:47 GMT 72
1.6.45-gca10ca949d 648.65 KB Sun, 08 Dec 2019 00:02:37 GMT 78
1.6.38-g53562c6460 648.53 KB Sat, 07 Dec 2019 00:02:52 GMT 63
1.6.37-g59ca277294 648.33 KB Thu, 05 Dec 2019 00:02:48 GMT 68
1.6.36-gb1837af930 648.34 KB Wed, 04 Dec 2019 00:02:42 GMT 76
1.6.30-g63dbda8190 602.44 KB Sat, 30 Nov 2019 00:02:39 GMT 67
1.6.29-ga23c3a3d0e 601.64 KB Fri, 29 Nov 2019 00:02:49 GMT 75
1.6.27-ge123f6b54a 601.65 KB Sat, 23 Nov 2019 00:02:39 GMT 62
1.6.26-g4d9f3cac3b 601.63 KB Wed, 13 Nov 2019 00:05:01 GMT 59
1.6.24-g180c8a69f2 601.65 KB Sat, 09 Nov 2019 00:02:46 GMT 66
1.6.21-g6630c0acce 601.64 KB Thu, 07 Nov 2019 00:05:44 GMT 73
1.6.20-g4f3f25fda9 600.52 KB Thu, 31 Oct 2019 00:03:59 GMT 65
1.6.19-g545b8fc912 600.58 KB Wed, 23 Oct 2019 00:03:11 GMT 66
1.6.18-gfd17f4be6e 600.43 KB Wed, 16 Oct 2019 00:03:10 GMT 62
1.6.17-gd245f470a3 600.44 KB Tue, 15 Oct 2019 00:03:05 GMT 92
1.6.16-g2a90a1c9c7 600.43 KB Sun, 13 Oct 2019 00:02:54 GMT 78
1.6.14-g207f346bee 600.17 KB Sat, 12 Oct 2019 00:03:00 GMT 70
1.6.12-gf3cce5ded8 600.14 KB Thu, 10 Oct 2019 00:03:16 GMT 63
1.6.11-g9321bd7ad2 598.61 KB Wed, 09 Oct 2019 00:02:59 GMT 74
1.6.10-g026c74a5bd 598.63 KB Sun, 06 Oct 2019 00:02:51 GMT 73
1.6.9-g0614f871bc 598.59 KB Tue, 01 Oct 2019 00:03:02 GMT 62
1.6.8-g589e210e74 598.6 KB Fri, 27 Sep 2019 00:03:02 GMT 63
1.6.7-g213b927ac7 598.6 KB Tue, 24 Sep 2019 00:03:05 GMT 62
1.6.1-g4ca01eb239 598.88 KB Mon, 23 Sep 2019 00:03:05 GMT 80
1.5.82-gf24b9d567c 598.89 KB Sun, 22 Sep 2019 00:02:42 GMT 63
1.5.80-g82a920864a 598.54 KB Fri, 20 Sep 2019 00:03:00 GMT 74
1.5.79-g2aa8ed683c 598.44 KB Wed, 18 Sep 2019 00:03:01 GMT 74
1.5.78-g903f61b6de 598.42 KB Tue, 17 Sep 2019 00:03:02 GMT 65
1.5.69-gafe227b39e 597.25 KB Sat, 07 Sep 2019 00:02:49 GMT 429
1.5.68-g75520ddc5f 597.65 KB Thu, 05 Sep 2019 00:02:58 GMT 66
1.5.66-g15eeb98f5d 597.59 KB Wed, 28 Aug 2019 19:08:07 GMT 74
1.5.65-g70b3ef31da 597.64 KB Wed, 21 Aug 2019 00:03:02 GMT 69
1.5.64-g428034d46a 597.66 KB Fri, 16 Aug 2019 00:02:53 GMT 76
1.5.63-g4e02ab0a27 597.4 KB Thu, 15 Aug 2019 00:02:53 GMT 58
1.5.61-g872e087e6a 596.74 KB Tue, 13 Aug 2019 00:03:06 GMT 73
1.5.59-gcca16685ed 596.76 KB Sat, 10 Aug 2019 00:02:49 GMT 58
1.5.58-gda509492a0 549.88 KB Fri, 09 Aug 2019 00:03:04 GMT 79
1.5.56-g83e93db6d8 549.86 KB Sun, 04 Aug 2019 00:03:37 GMT 83
1.5.55-g55c866f142 549.85 KB Thu, 01 Aug 2019 00:03:03 GMT 61
1.5.54-g49ec4b9703 548.24 KB Sun, 28 Jul 2019 00:02:50 GMT 71
1.5.53-g4d61d296e3 548.23 KB Sat, 27 Jul 2019 08:19:11 GMT 60
1.5.52-g84d47a144c 548.15 KB Fri, 26 Jul 2019 00:02:44 GMT 71
1.5.51-ged9195d73b 548.18 KB Thu, 25 Jul 2019 00:03:06 GMT 36291
1.5.49-ge3d1a6c9df 548.12 KB Wed, 24 Jul 2019 00:02:57 GMT 875
1.5.47-g016c3630ca 548.11 KB Wed, 17 Jul 2019 03:20:47 GMT 3890
1.5.46-ga339983da4 548.1 KB Mon, 15 Jul 2019 12:42:38 GMT 75
1.5.45-gec04c7d82f 548.07 KB Thu, 04 Jul 2019 08:31:19 GMT 82
1.5.44-ge159335949 547.78 KB Mon, 01 Jul 2019 00:03:07 GMT 61
1.5.41-g53a3242437 547.65 KB Fri, 28 Jun 2019 00:02:55 GMT 75
1.5.40-gd5d0a0b59c 545.68 KB Sat, 22 Jun 2019 05:16:34 GMT 79
1.5.39-gf14ee2b7fb 545.66 KB Tue, 18 Jun 2019 00:03:00 GMT 67
1.5.37-g2bbe53f6e0 598.17 KB Mon, 17 Jun 2019 01:35:07 GMT 73
1.5.36-gcc60b0dba7 598.18 KB Sun, 16 Jun 2019 00:03:05 GMT 75
1.5.33-g66a0119867 598.19 KB Tue, 11 Jun 2019 00:02:50 GMT 75
1.5.31-g0f85b3ce80 598.13 KB Sat, 08 Jun 2019 00:02:50 GMT 66
1.5.25-g6209239d69 545.91 KB Mon, 03 Jun 2019 00:02:45 GMT 71
1.5.24-ge5998d8fbd 545.92 KB Sat, 01 Jun 2019 00:02:52 GMT 78
1.5.2-g24d5acafc6 598.13 KB Fri, 07 Jun 2019 00:03:18 GMT 68
1.5.1-gbaad0091a5 545.86 KB Mon, 27 May 2019 00:11:02 GMT 66
1.5.1-gb8abd2b9a3 545.87 KB Tue, 28 May 2019 00:03:14 GMT 70
1.5.1-g7806f43ae7 545.88 KB Mon, 27 May 2019 00:27:26 GMT 72
1.5.1-g5a139b200f 545.9 KB Thu, 30 May 2019 00:02:57 GMT 68
1.5.1-g2905b634fc 545.87 KB Mon, 27 May 2019 00:21:58 GMT 71
1.5.1-g2150873b65 545.88 KB Mon, 27 May 2019 00:14:37 GMT 71
1.5.1-g0f6cf3fc85 545.87 KB Sun, 26 May 2019 23:56:39 GMT 67
1.5.1-g0dd56242f2 545.9 KB Wed, 29 May 2019 00:03:08 GMT 67
1.5.1-g02708bbaea 545.88 KB Mon, 27 May 2019 00:02:55 GMT 113