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

Exclude in finecodecoverage-settings.xml not working #349

Closed dingetje closed 11 months ago

dingetje commented 11 months ago

Installed product versions

Description

Exclude in finecodecoverage-settings.xml not working as expected

Steps to recreate

  1. Install Fine Code Coverage Add-on
  2. Add finecodecoverage-settings.xml to project
  3. Add Exclude pattern in finecodecoverage-settings.xml based on namespace
  4. Run unit tests
  5. Code coverage report still shows excluded namespace classes

Current behavior

Exclude settings seem to be ignored

Expected behavior

Exclude pattern should be applied to code coverage setting

Side Notes

dingetje commented 11 months ago

Here's my anonymized finecodecoverage-settings.xml

<FineCodeCoverage>
    <Enabled>
        True
    </Enabled>
    <Exclude>
        [*]FooNameSpace.*
    </Exclude>
    <ExcludeByFile>
        **/XSDGenerated.designer.cs
    </ExcludeByFile>
    <ExcludeByAttribute>
    </ExcludeByAttribute>
    <ModulePathsExclude>
        .*UnitTests.dll
        .*Moq.dll
    </ModulePathsExclude>
</FineCodeCoverage>
tonyhallett commented 11 months ago

The expected behaviour is that the applicable settings for the coverage provider in use should be applied, and they are. You can see that in the FCC output pane of the Visual Studio output window.

You have a mixture of coverage settings. ModulePathsExclude is an ms code coverage setting whereas Exclude / ExcludeByFile and ExcludeByAttribute are OpenCover / Coverlet settings ( non ms code coverage ).

dingetje commented 11 months ago

Thanks @tonyhallett great answer! I know exactly what to do now, not!