Pre-Coverage Filters
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.
- Value
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: The following feature is only available in NCover version 5 and higher.
NCover 5 allows navigation into a project even if no coverage data has been collected yet.
Any Code Central admin can now create a project on Code Central and add an initial set of pre-coverage filters.
These filters are shared and applied to a connected Collector or Desktop even before any coverage is collected or synced to Code Central.