I've recently become very interested in improving my project's test coverage. At this point, I have a submodule pretty thoroughly tested, but it's coverage is still pretty low because the tool is picking up all of my views as entirely uncovered. (I'm using MVP, so these views are really "dumb", they don't need to be tested in my opinion.) Before I go slapping an [ExcludeCodeCoverage]
attributes on my views, I'd like to know if there are any downsides to this.
To be clear about things, I'm only looking to do this at the class level. For example, I have a method that hits the file system. Obviously, I can't test it (easily), but I consider the fact that I can't test it a smell. Since it's a smell, the reduced coverage on this class is an alert to me that there's something in need of refactoring. I will not be excluding anything "just to get the numbers up". I'm just interested potential pitfalls of excluding the UI layer and simple class factories like this.
public class SourceControlProviderFactory : ISourceControlProviderFactory
{
public ISourceControlProvider CreateProvider(VBProject project)
{
return new GitProvider(project);
}
public ISourceControlProvider CreateProvider(VBProject project, IRepository repository)
{
return new GitProvider(project, repository);
}
}
This question is closely related, but I've already targeted the code I'd like to exclude. I'm more interested in "Are there good reasons not to do this?" as opposed to "What should I exclude?".