0

We decided to enable code coverage metrics and now we're customizing settings to include/exclude different things. We have some classes that look like following:

public class MyOptions
{
    public string SomeConfigValue { get; set; }
}

And code coverage for this class is 0%. My first thought was to exclude this class from code coverage at all as there is actually nothing to cover here and it's just a settings file.

What are best practices on what to include and especially exclude from code coverage?

steavy
  • 1,483
  • 6
  • 19
  • 42

1 Answers1

0

I would suggest not to include/exclude files manually from code coverage metrics. First, you need to focus on writing unit test cases against your code and then in some later stage you may exclude files from code coverage if coverage percentage is too low due to irrelevant files.

Although auto generated code is one of the candidate to be excluded.

Sham
  • 910
  • 8
  • 15