minicover - MiniCover 2.0.0-ci-20180504053437

Minimalist Code Coverage Tool for .NET Core

PM> Install-Package MiniCover -Version 2.0.0-ci-20180504053437 -Source https://www.myget.org/F/minicover/api/v3/index.json

Copy to clipboard

> nuget.exe install MiniCover -Version 2.0.0-ci-20180504053437 -Source https://www.myget.org/F/minicover/api/v3/index.json

Copy to clipboard

> dotnet add package MiniCover --version 2.0.0-ci-20180504053437 --source https://www.myget.org/F/minicover/api/v3/index.json

Copy to clipboard
<PackageReference Include="MiniCover" Version="2.0.0-ci-20180504053437" />
Copy to clipboard
source https://www.myget.org/F/minicover/api/v3/index.json

nuget MiniCover  ~> 2.0.0-ci-20180504053437
Copy to clipboard

> choco install MiniCover --version 2.0.0-ci-20180504053437 --source https://www.myget.org/F/minicover/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "minicover" -SourceLocation "https://www.myget.org/F/minicover/api/v2"
Install-Module -Name "MiniCover" -RequiredVersion "2.0.0-ci-20180504053437" -Repository "minicover" -AllowPreRelease
Copy to clipboard

MiniCover

Code Coverage Tool for .NET Core

Build Status Nuget Coverage Status

Supported .NET Core SDKs

  • 6.0 (Global tool or local tool)
  • 7.0 (Global tool or local tool)
  • 8.0 (Global tool or local tool)

Installation

MiniCover can be installed as a global tool:

dotnet tool install --global minicover

Or local tool:

dotnet tool install minicover

Commands

This is a simplified documentation of MiniCover commands and options.

Use --help for more information:

minicover --help

When installed as local tool, MiniCover commands must be prefixed with dotnet. Example:

dotnet minicover --help

Instrument

minicover instrument

Use this command to instrument assemblies to record code coverage.

It is based on the following main options:

option description type default
sources source files to track coverage glob src/**/*.cs
exclude-sources exceptions to source option glob **/bin/**/*.cs and **/obj/**/*.cs
tests test files used to recognize test methods glob tests/**/*.cs and test/**/*.cs
exclude-tests exceptions to tests option glob **/bin/**/*.cs and **/obj/**/*.cs
assemblies assemblies considered for instrumentation glob **/*.dll
exclude-assemblies Exceptions to assemblies option glob **/obj/**/*.dll

Note 1: Assemblies not related to sources or tests are automatically ignored.

Note 2: Supported syntax for glob values.

Note 3: You can repeat glob options to represent multiple values. Example: --sources "a/**/*.cs" --sources "b/**/*.cs"

This command also generates a coverage.json file with information about the instrumented code.

Uninstrument

minicover uninstrument

Use this command to revert the instrumentation based on coverage.json file.

Make sure you call uninstrument before publishing or packing your application.

Reset

minicover reset

Use this command to reset the recorded coverage so far.

Report

minicover report

Use this command to print a coverage report in the console.

The command exits with failure if the coverage doesn't meet a specific threshold (90% by default).

More commands

  • cloverreport: Write an Clover-formatted XML report to file
  • coberturareport: Write a cobertura XML report to file
  • coverallsreport: Prepare and/or submit coveralls reports
  • htmlreport: Write html report to folder
  • opencoverreport: Write an OpenCover-formatted XML report to file
  • xmlreport: Write an NCover-formatted XML report to file

Use --help for more information.

Build script example

dotnet restore
dotnet build

# Instrument
minicover instrument

# Reset hits
minicover reset

dotnet test --no-build

# Uninstrument
minicover uninstrument

# Create html reports inside folder coverage-html
minicover htmlreport --threshold 90

# Console report
minicover report --threshold 90

Ignore coverage files

Add the following to your .gitignore file to ignore code coverage results:

coverage-html
coverage-hits
coverage.json

Libraries

When using MiniCover libraries:

  • use dependency injection to create instances
  • use only the main interfaces listed on each package below

By doing that, you reduce the risk of being impacted by future MiniCover changes.

MiniCover.Core

Main MiniCover operations.

Dependency injection configuration:

services.AddMiniCoverCore();

Main interfaces:

  • IInstrumenter
  • IUninstrumenter
  • IHitsReader
  • IHitsResetter

MiniCover.Reports

MiniCover reports.

Dependency injection configuration:

services.AddMiniCoverCore();
services.AddMiniCoverReports();

Main interfaces:

  • ICloverReport
  • ICoberturaReport
  • IConsoleReport
  • ICoverallsReport
  • IHtmlReport
  • IHtmlSourceFileReport
  • INCoverReport
  • IOpenCoverReport
  • .NETCoreApp 2.0
    • Microsoft.Extensions.CommandLineUtils (>= 1.1.1)
    • Microsoft.Extensions.DependencyModel (>= 2.0.4)
    • Microsoft.Extensions.FileSystemGlobbing (>= 2.0.1)
    • Microsoft.NETCore.App (>= 2.0.0)
    • Mono.Cecil (>= 0.10.0)
    • Newtonsoft.Json (>= 11.0.1)
  • .NETCoreApp 2.0: 2.0.0.0

Owners

lucaslorentz

Authors

Lucas Lorentz

Project URL

https://github.com/lucaslorentz/minicover

License

Unknown

Tags

coverage,cover,minicover

Info

5 total downloads
5 downloads for version 2.0.0-ci-20180504053437
Download (48.59 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.0-ci-20180504053437 48.59 KB Fri, 04 May 2018 05:34:54 GMT 5
2.0.0-ci-20180503182002 48.52 KB Thu, 03 May 2018 18:20:22 GMT 0
2.0.0-ci-20180422140801 47.28 KB Sun, 22 Apr 2018 14:08:18 GMT 0
2.0.0-ci-20180419055249 47.4 KB Thu, 19 Apr 2018 05:53:09 GMT 0
2.0.0-ci-20180419053505 47.4 KB Thu, 19 Apr 2018 05:35:23 GMT 0
2.0.0-ci-20180419053148 41.67 KB Thu, 19 Apr 2018 05:32:08 GMT 0
2.0.0-ci-20180409064239 41.36 KB Mon, 09 Apr 2018 06:42:53 GMT 0
2.0.0-ci-20180331091827 41.36 KB Sat, 31 Mar 2018 09:18:44 GMT 0
2.0.0-ci-20180330073318 40.31 KB Fri, 30 Mar 2018 07:33:36 GMT 0