visual-studio-2010mstestncover

How do I mark code to be excluded from code coverage analysis in VSTS


NCover has an attribute IgnoreFromCoverage that allows for code to be marked for exclusion during code coverage analysis. Is there a way to do this with the VSTS Code Coverage Tools?

Obvious uses for this would be auto property getters and setters, non obvious uses may be code generated by R# equals implementation or ORM generated code.


Solution

  • For Visual Studio 2010 you can use the ExcludeFromCodeCoverage attribute. You can apply the attribute to an entire class or to methods within a class. See MSDN for more information.