code4it-dev / blog-comments

https://www.code4it.dev/
1 stars 0 forks source link

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

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

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

makolyte commented 3 years ago

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.

bellons91 commented 3 years ago

Glad to hear that!

the-dext commented 3 years ago

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

bellons91 commented 3 years ago

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

tngraf commented 2 years ago

Great article, thanks a lot for it!

balintn22 commented 2 years ago

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 <?xml version="1.0" encoding="utf-8"?>

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

Hth.

sreelakzme commented 1 year ago

This is just the perfect article I found.

ooples commented 1 year ago

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

EvertonJSilva commented 1 year ago

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".

vsix27 commented 1 year ago

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 commented 1 year ago

@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!