Sometimes, you do not need to know code coverage data solution-wide. For example, you may not be interested in coverage statistics for code marked with ObsoleteAttribute or a specific legacy project. In this case, you can set coverage filters based on namespace, project, type, type member, or attribute.
There are two scopes for coverage filters:
- All Solutions - global filters that apply to all solutions in your computer.
- Current Solution - per-solution filters that apply to the current solution. You can share these filters with your team; see Sharing Coverage Filters for details.
After you calculate code coverage, the filtered items are not included in the coverage snapshot and not shown in the Coverage Results Browser or in the Coverage area of the Unit Test Sessions window .
If some combination of filters excludes everything from the snapshot, this snapshot appears empty.
By default, dotCover provides a global filter for excluding code items by the ExcludeFromCodeCoverageAttribute attribute. The filter is disabled by default. If necessary, you can enable, modify or remove it.
Coverage filters are saved in the dotCover settings. If you reset all settings, all coverage filters will be removed. For more information about dotCover settings, see Managing and Sharing Options.
Besides setting up coverage filters, dotCover provides the following ways of filtering and searching coverage results;
- You can disable some unit tests by categories. To do so, specify the categories that you want to disable in the Don't run tests from categories field in the dotCover Options | Unit Testing.
- You can exclude nodes form the current presentation of the coverage snapshot after coverage analysis. Note that the Exclude selected node and create coverage filter command allows creating a coverage filter automatically for the selected item.
- You can search code coverage tree to display only the items that match the search expression.
- Basic Concepts
- Supported Languages and Frameworks
- Execution and Coverage Analysis of Unit Tests
- Coverage Analysis of Manual Test Sessions