Search code examples
visual-studiounit-testingc#-4.0code-coverage

Class files are missing in code coverage result


I have a number of classes in my project. When I check Code Coverage result after running the unit test cases, it does not show all the classes. I am not sure what are the criteria on which the code coverage process the class files.

I read somewhere that if you have not created the test cases for a class file in your Test project it will not be covered in the code coverage. But for me it does not seem true as I can see the the class files even though those are not in the test project.


Solution

  • there are couple of ways to exclude files from code coverage, most popular being an attribute:

    [ExcludeFromCodeCoverage]