How to exclude classes from an OpenCover report
Asked Answered
S

1

7

In generating coverage reports with OpenCover (and then generating an HTML report with ReportGenerator) for an MSTest suite, I am trying to exclude framework generated classes. In particular, classes generated under the project's namespace by a service reference.

The command I am using to generate the XML files looks like:

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

I have also tried to exclude by file:

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

but the service reference classes still show up in the XML file.

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

Seineetmarne answered 17/9, 2012 at 20:1 Comment(0)
N
12

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

-filter:"+[*]* -[*]*.AWebService.*"
Nerine answered 17/9, 2012 at 21:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.