question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Only the "CollectCoverage" property is working

See original GitHub issue

I’m following the guide here to try and use coverlet to create a code coverage report.

In summary, I’ve run the following commands:

dotnet new xunit -n XUnit.Coverlet.MSBuild
cd XUnit.Coverlet.MSBuild
dotnet add package coverlet.msbuild
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

The issue is with the final step, where the output is:

image

So the output is still the default “coverage.json” instead of the expected cobertura xml.

So I tested with some other properties, and they also don’t work:

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

And the output is exactly the same:

image

I’ve run the same thing on my home PC, and it is not having the same issues.

The only difference I can think of is that the PC with the issue is a Windows Server 2016 machine, and my home PC is a Windows 10.

I’ve tried a complete uninstall and reinstall of Visual Studio which didn’t help.

Can anyone suggest a way I can get this to work?

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
daveMuellercommented, Dec 22, 2022

I close this as the external issue is fixed. Feel free to reopen.

1reaction
john0879commented, Dec 6, 2022

Tried this instead based on a comment in #1391 and it worked.

dotnet test -p:CollectCoverage=true -e:CoverletOutputFormat=cobertura -e:CoverletOutput='../../TestResults/'

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to collect coverage in Jest
The test execution is running fine. However I am not able to collect code coverage correctly. The coverage is only logged for folder...
Read more >
Jest is "stuck" on only generating coverage for tested files ...
We are running jest, specifying to test only certain files, then trying to collect coverage on the entire src directory.
Read more >
Coverlet does not generate single coverage report file for ...
Hi Team,. We are trying to generate and report Code Coverage to azure server using Coverlet and ReportGenerator. We are collecting coverage ...
Read more >
coverlet
Enabling code coverage is as simple as setting the CollectCoverage property to true. dotnet test /p:CollectCoverage=true. After the above command is run, ...
Read more >
Use code coverage for unit testing - .NET
Code coverage is a measurement of the amount of code that is run by unit tests - either lines, branches, or methods. As...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found