FortuneN / FineCodeCoverage

Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage
Other
516 stars 39 forks source link

Unable to configure coverlet with DoesNotReturnAttribute option #358

Closed DwayneNeed closed 7 months ago

DwayneNeed commented 10 months ago

Installed product versions

Description

Unable to configure coverlet with DoesNotReturnAttribute option

Steps to recreate

  1. Set DoesNotReturnAttribute setting in .runsettings according to https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md
  2. run unit tests
  3. observe the generated FCC.runsettings generated file is missing the setting

Current behavior

The DoesNotReturnAttribute setting is not included in the generated FCC.runsettings file.

Expected behavior

Ideally, the FCC UX would allow setting this option directly. It should also allow it to be specified in the .runsettings file and include it in the generated FCC.runsettings file.

I tried to use a template to force the setting to be included, but I was not able to make that work. I looked for examples of the template and didn't find anything.

tonyhallett commented 10 months ago

The runsettings template is for ms code coverage only. Does ms code coverage take into account the DoesNotReturnAttribute ?

DwayneNeed commented 10 months ago

No, ms code coverage does not seem to respect the DoesNotReturn attribute. I've raised an issue with them internally too. It looks like coverlet is the only coverage tool that supports it right now.

tonyhallett commented 10 months ago

It is possible that ms code coverage does - FCC uses version 17.1. It is now at 17.7.2.

I believe that this is their issues

DwayneNeed commented 10 months ago

I didn't see it in their issue list, so I added it: https://github.com/microsoft/codecoverage/issues/58

tonyhallett commented 7 months ago

If you want to use DoesNotReturnAttribute setting then you can

Fine Code Coverage will use the Data Collector driver under two circumstances :

You are testing with runsettings that contains the coverlet collector ( and not disabled)

tonyhallett commented 7 months ago

I will check if we are using the correct version of coverlet

tonyhallett commented 7 months ago

Appears so https://github.com/coverlet-coverage/coverlet/blame/3ec85e7a331c4393a38a62d3c099ea71bfc20297/src/coverlet.collector/DataCollection/CoverletSettingsParser.cs