regexopencoverreportgenerator

OpenCover Filter not working


I and using OPenCover to get the code coverage and want to filter test assemblies, Spring.NET assembly and autogenerated code from OpenCover report. I am passing following parameters to Opencover

OpenCover.Console.exe -register:user -target:"D:\Softwares\OPenCover\TestProj.dll" -filter:"+[*]* -[Namespace1.Namespace2.*.*Test]* [Spring*] Spring*.* [*ArchiveXSD*].ArchiveXSD.* [Namespace1.Namespace2.Namespace3.Namespace4.*.*XSD*]*" -mergebyhash -output:C:\Reports\projectCoverageReport1.xml -skipautoprops -hideskipped:All

However in the generated report I still see coverage for the XSD and Spring.NET (which is ZERO).

Have I used the switches for inclusion and exclusion correctly?

Thanks,


Solution

  • You need to add inclusion/exclusion markers (+/-) on each filter e.g.

    -filter:"+[*]* -[Namespace1.Namespace2.*.*Test]* -[Spring*]Spring*.* -[*ArchiveXSD*]ArchiveXSD.* -[Namespace1.Namespace2.Namespace3.Namespace4.*.*XSD*]*"