Setting pre-coverage filters is a recommended best practice for all NCover users.
Using pre-coverage filters to collect only specific data has two primary benefits:
- Reduces the data store size, the overall profiling load and improves collection speed and performance.
- Simplifies report creation, particularly reports including method and class details.
Pre-Coverage filters have four configurable parameters:
- Include or Exclude
- Type - Module, Namespace, Class, Method,Property and Attribute.
- Condition - Matches, Starts With, Ends With, Contains, and Regex.
Tip: When using 'Starts with' and 'Namespace', the full name of the namespace is required.
Likewise, the Class name displayed in the NCover GUI is abbreviated for ease of navigation, but when creating a filter using 'Starts with' and 'Class', the full name of the class is required.
For these reasons, the 'Contains' Condition generally gives the expected results with both namespace and class filters.
In the example below, we've created an Exclude rule for the CalcController, since it is simply entering test data, and an Include rule for the CalcTest, which contains the actual unit tests.
Note: A module that has been filtered out by name will not display in coverage results.
However, if a module is outside of an included namespace, for example, it displays like a module that is loaded, but has no coverage.
Originally, those "blank" modules were simply not displayed, but this functionality was changed so that users don't experience "disappearing modules", unless they exclude them specifically.