I use White to write tests regarding the user interface of my applications. Then I run them using OpenCover and using ReportGen I create a test report.
My only complaint with the result is that my reports combine both MyForm.cs and MyForm.Designer.cs when reporting which part of the MyForm class is covered. My problem is that if any test concerns MyForm, then all the code in the .Designer.cs file .Designer.cs added to the report as male (the files contain only one auto-generated method for creating all the controls created by the constructor). This content of a simple template file does not contain any useful logic. However, especially in thin classes, this file can have most of the common code in the class. This leads to classes showing a high level of coverage, despite the fact that my tests are slightly related or do not have any code that could benefit from testing. (ex Testing that the "Show My Form" button creates a "My Form" dialog box will cause all the contents of MyForm.Designer.cs be closed, but will not actually check any UI logic in class MyForm.)
The -filter argument for OpenCover only works at the class / namespace level; therefore, I cannot use them only to exclude the contents of the constructor file (or inside the InitializeComponents function). Is there another way to filter the code that is used to generate the report to exclude this from the output?
source share