coverlet-coverage / coverlet

Cross platform code coverage for .NET
MIT License
2.99k stars 385 forks source link

Add `Threshold` feature to vstest collectors integration #682

Open MarcoRossignoli opened 4 years ago

MarcoRossignoli commented 4 years ago

Today with .net tool/msbuild you can specify a coverage threshold below which it fails the build.

https://github.com/tonerdo/coverlet/blob/master/Documentation/MSBuildIntegration.md#threshold

This is not supported on vstest collector integration

cc: @vagisha-nidhi

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 3 months with no activity.

Bertk commented 2 months ago

[!TIP] use reportgenerator which supports minimum coverage thresholds

  • use dotnet-reportgenerator-globaltool to create a HTML report and a merged coverage file

    reportgenerator -reports:"**/*.cobertura.xml" -targetdir:"artifacts\reports.cobertura" -reporttypes:"HtmlInline_AzurePipelines_Dark;Cobertura" --minimumCoverageThresholds:lineCoverage=80

https://github.com/danielpalme/ReportGenerator/blob/2a2ed5dadf6f5b17e0dc14c91e711cf5ff991688/src/ReportGenerator.Core/appsettings.json#L7