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

blog/code-coverage-vs-2019-coverlet #5

Open
utterances-bot opened this issue Dec 31, 2020 · 11 comments
Open

blog/code-coverage-vs-2019-coverlet #5

utterances-bot opened this issue Dec 31, 2020 · 11 comments

Comments

@utterances-bot
Copy link

How to view code coverage with Coverlet and Visual Studio 2019 | Code4IT

Code coverage is an indicator of the quality of your code. With Coverlet and VS2019 you can have a human readable report to see where to improve your code.

https://www.code4it.dev/blog/code-coverage-vs-2019-coverlet

Copy link

Previously I found it difficult to try to get coverlet working. This article really clears it up and makes it simple to add/use coverlet.

Copy link
Contributor

Glad to hear that!

Copy link

Hi, I'm the author of the Run Coverlet Report extension. Thanks for blogging about it !

@bellons91
Copy link
Contributor

Glad you liked it! Is there anything else I could add? :)

Copy link

tngraf commented Dec 24, 2021

Great article, thanks a lot for it!

Copy link

Great summary, thank you!

I found one caveat: the dotnet tool commands use my nuget configuration, but only the first entry.
In my case, it hit a private nuget feed and failed with
"error NU1301: Failed to retrieve information about
'dotnet-reportgenerator-globaltool' from remote source 'https://..."

I resolved by creating a temporary nuget config file like this

<configuration>
    <packageSources>
        <clear />
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    </packageSources>
</configuration>

named it NuGet2.config
and suffixed the commands with "--configfile NuGet2.config".

Hth.

Copy link

This is just the perfect article I found.

Copy link

ooples commented Jan 8, 2023

This helped me out quite a bit but I was wondering if you could publish the steps on how to add coverlet reports to the github yaml files so I can add coverage to my current build workflow

Copy link

First of all, it's a great article and it helped me a lot. Thanks for the article.

I leave here my contribution. I was using it in VS 2019 without any problems, but in VS 2022 it stopped working, after a search I found that .Net had a bug covering up to SDK version 7.0.101. After updating the SDK, everything is working perfectly again. Including using "Integration Type" as MSBuild".

Copy link

vsix27 commented Jul 5, 2023

Tried in VS 2022 Preview - does not work -
it pops command window and run tests - some passed, some failed - all expected, prints status in the end, but after that it pops error message - cannot find Cobertura.xml
so...

  1. it is looking in the wrong place (or xml file is created in the wrong place) %userprofile%\AppData\Local\Temp\b83396cd-c53e-4e73-a969-ad33a3d58629\coverageReport\Cobertura.xml

  2. crated file %userprofile%\AppData\Local\Temp\b83396cd-c53e-4e73-a969-ad33a3d58629\coverage\475ff28d-86ff-48ad-a842-d49167755ae1\coverage.cobertura.xml file has no test data

@bellons91
Copy link
Contributor

@vsix27, I suppose it's just because some tests are failing.
Try to fix them (or, at least, comment them), and run the script again - and let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants