All Projects → coverlet-coverage → Coverlet

coverlet-coverage / Coverlet

Licence: mit
Cross platform code coverage for .NET

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Coverlet

Altcover
Cross-platform coverage gathering and processing tool set for .net/.net core and Mono
Stars: ✭ 344 (-85.06%)
Mutual labels:  cross-platform, dotnet-core, coverage, code-coverage
FineCodeCoverage
Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
Stars: ✭ 391 (-83.02%)
Mutual labels:  unittest, code-coverage, coverlet
Minicover
Cross platform code coverage tool for .NET Core
Stars: ✭ 193 (-91.62%)
Mutual labels:  dotnet-core, coverage, code-coverage
instrumentation
Assorted pintools
Stars: ✭ 24 (-98.96%)
Mutual labels:  coverage, instrumentation, code-coverage
Opentabletdriver
Open source, cross-platform, user-mode tablet driver
Stars: ✭ 424 (-81.59%)
Mutual labels:  cross-platform, dotnet-core
Utplsql
Testing Framework for PL/SQL
Stars: ✭ 402 (-82.54%)
Mutual labels:  coverage, code-coverage
Kcov
Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
Stars: ✭ 515 (-77.64%)
Mutual labels:  instrumentation, coverage
Phpspec Code Coverage
Generate Code Coverage reports for PhpSpec tests
Stars: ✭ 59 (-97.44%)
Mutual labels:  unittest, code-coverage
Fusillade
An opinionated HTTP library for Mobile Development
Stars: ✭ 269 (-88.32%)
Mutual labels:  cross-platform, dotnet-core
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (-66.35%)
Mutual labels:  cross-platform, dotnet-core
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.
Stars: ✭ 1,276 (-44.59%)
Mutual labels:  dotnet-core, code-coverage
Bashcov
Code coverage tool for Bash
Stars: ✭ 113 (-95.09%)
Mutual labels:  coverage, code-coverage
Modern.forms
Cross-platform spiritual successor to Winforms for .NET Core
Stars: ✭ 323 (-85.97%)
Mutual labels:  cross-platform, dotnet-core
Simplecov
Code coverage for Ruby with a powerful configuration library and automatic merging of coverage across test suites
Stars: ✭ 4,362 (+89.41%)
Mutual labels:  coverage, coverage-library
Simplcommerce
A simple, cross platform, modularized ecommerce system built on .NET Core
Stars: ✭ 3,474 (+50.85%)
Mutual labels:  cross-platform, dotnet-core
Simplifyify
A simplified Browserify and Watchify CLI
Stars: ✭ 37 (-98.39%)
Mutual labels:  cross-platform, code-coverage
Yacep
yet another csharp expression parser
Stars: ✭ 107 (-95.35%)
Mutual labels:  cross-platform, dotnet-core
Easy.logger
A modern, high performance cross platform wrapper for Log4Net.
Stars: ✭ 118 (-94.88%)
Mutual labels:  cross-platform, dotnet-core
Single cov
Actionable code coverage.
Stars: ✭ 154 (-93.31%)
Mutual labels:  coverage, code-coverage
Cake.Coverlet
Coverlet extensions for Cake Build
Stars: ✭ 39 (-98.31%)
Mutual labels:  coverage, coverlet

Coverlet

Build Status 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 supports only .NET Core application)

Installation

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 5 applications, you've only to update to last version if needed.

Usage

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

  • You need to be running .NET Core SDK v2.2.401 or newer
  • You need to reference version 16.5.0 and above of Microsoft.NET.Test.Sdk
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />

MSBuild Integration (suffers of possible known issue)

Installation

dotnet add package coverlet.msbuild

N.B. You MUST add package only to test projects

Usage

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

Requires a runtime that support .NET Standard 2.0 and above

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

Installation

dotnet tool install --global coverlet.console

Usage

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

.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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].