How to exclude classes from an OpenCover report

When creating coverage reports using OpenCover (and then generating an HTML report using ReportGenerator) for the MSTest package, I try to exclude classes generated by the generated frames. In particular, classes created in the project namespace using a service reference.

The command I use to generate the XML files looks like this:

OpenCover.Console.exe -register:user "-target:MyProject.Tests.dll" -targetargs:"/testcontainer:MyContainer" -output:coverage.xml -mergebyhash -filter:-*.AWebService.* 

I also tried excluding by file:

 OpenCover.Console.exe -register:user "-target:MyProject.Tests.dll" -targetargs:"/testcontainer:MyContainer" -output:coverage.xml -mergebyhash -excludebyfile:*Reference.cs 

but service reference classes are still displayed in the XML file.

Is there a way to exclude only those specific classes created by Visual Studio?

+7
source share
1 answer

It looks like you forgot the assembly part in the arg filter, try this:

 -filter:"+[*]* -[*]*.AWebService.*" 
+12
source

All Articles