Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverlet is generating 0% line coverage #824

Closed
VenkateshSrini opened this issue Apr 24, 2020 · 7 comments
Closed

Coverlet is generating 0% line coverage #824

VenkateshSrini opened this issue Apr 24, 2020 · 7 comments
Labels
Known Issue It's a know issue

Comments

@VenkateshSrini
Copy link

Hi,
code coverage with coverlet.mbuild and .NET core 3.1 is giving issue. It is showing 0% code coverage when run using dotnet test command. The code can be been at
https://github.com/VenkateshSrini/FSEPMAPI.

The command that is used to generate code coverage is provided in runCoverage.cmd

@MarcoRossignoli MarcoRossignoli added the Known Issue It's a know issue label Apr 24, 2020
@MarcoRossignoli
Copy link
Collaborator

I did some test and seem you're hitting know issue with msbuild driver https://github.com/tonerdo/coverlet/blob/master/Documentation/KnownIssues.md#1-vstest-stops-process-execution-earlydotnet-test
We have an old issue that uses RavenDB with same problem #342
I did a test with vstest integration throught collectors and works https://github.com/tonerdo/coverlet/blob/master/Documentation/VSTestIntegration.md
image

@VenkateshSrini
Copy link
Author

Is there some work around that I can adopt to get the report. I need this to be submitted to management

@MarcoRossignoli
Copy link
Collaborator

MarcoRossignoli commented Apr 24, 2020

Yes as I said you need to use collectors integration and not use msbuild follow guide https://github.com/tonerdo/coverlet/blob/master/Documentation/VSTestIntegration.md

I cloned your repo, added to test project

    <PackageReference Include="coverlet.collector" Version="1.2.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

Run from root repo

dotnet test --collect:"XPlat Code Coverage"

and with report generator I generated html reports in same way.

@VenkateshSrini
Copy link
Author

Hi,
I tried it. It works well. I have only a small problem. I used the following code dotnet test --collect:"XPlat Code Coverage" -r "_codeCoverage" inside the _codeCoverage another directory whole name is a Guid is getting generated. It is becoming difficult to generate the reports as the GUID is unpredictable. Is there a way how we can avoid this GUID subdirectory

@MarcoRossignoli
Copy link
Collaborator

Is there a way how we can avoid this GUID subdirectory

Unfortunately not, I opened an issue on vstest repo microsoft/vstest#2378 it's not related to coverlet.

@MarcoRossignoli
Copy link
Collaborator

Feel free to close if resolved!

@MarcoRossignoli
Copy link
Collaborator

Close because solved!Feel free to re-open if needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Known Issue It's a know issue
Projects
None yet
Development

No branches or pull requests

2 participants