The test runner, when running with coverage, should respect code marked with [ExcludeFromCodeCoverage] such that, regardless of the actual test coverage (if any), code marked with that attribute should appear fully covered.
Currently I have a class under test where the whole class is marked with [ExcludeFromCodeCoverage]. i do have a couple of unit tests that run against the class but in general when looking at coverage reports I don't want that to appear as though it's not properly covered.
When running these tests through the CodeRush for Roslyn test runner with coverage, that class currently appears as 44.44% covered, so my overall coverage (in this very small project) appears to be 67.53% covered rather than 100% covered.
Even better might be some sort of visual differentiation to show that the uncovered bits are explicitly excluded (but the overall coverage percentage shouldn't be penalized for excluded code).
Screen shot attached.
Hi Travis,
I totally agree that Code Coverage should provide the capability to exclude areas of code from analysis. We will introduce this feature in one of future releases.