coverlet-coverage / coverlet

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

Coverlet is generating 0% coverage #1557

Closed Oblutack closed 11 months ago

Oblutack commented 12 months ago

I test with dotnet test using msbuild v6.0.0. It doesn't generate anything. I tried using collector and running dotnet test --collect:"XPlat Code Coverage" and it only displays zeros in the report aswell. https://github.com/Oblutack/TS_Zadaca2

Bertk commented 11 months ago

Hi, sorry but the current information is not sufficient.

We use a GitHub issue template which should be used to reduce additional question on the topic.

Observation

Please find buildable and testable csproj files: TSZadaca2.zip

Microsoft.CodeCoverage shows this in Visual Studio:

image
Bertk commented 11 months ago

Using the updated csproj files will generate code coverage output.

dotnet test --no-build -bl:test.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
reportgenerator -reports:"**/*.opencover.xml" -targetdir:"artifacts\reports" - reporttypes:"Html;HtmlInline_AzurePipelines_Dark;Cobertura"
image

ReportGenerator can be used for HTML report.

image

reports.zip

Bertk commented 11 months ago

I close the issue and recommend to read the Microsoft and coverlet documentation