All coverage filters that affect the current solution, both per-solution and global, are displayed in the Coverage Filters dialog. If no solution is opened, the dialog shows only global filters. In this dialog, you can enable, disable, add, remove, and modify coverage filters.
You cannot edit coverage filters while the coverage analysis is in progress, e.g. when you started and not finished a manual test session under dotCover control or when the coverage analysis of unit tests is in progress.
- Choose dotCover | Edit Coverage Filters on the main menu.
- In the Coverage Filters dialog that appears, you will see the list of filters specified globally ond for the current solution.
- Use the Group by selector to change the grouping of filters - by scope or by kind.
- To enable or disable a filter, use the check-box next to it.
- To remove a filter, select it in the list and click Delete
- To edit a filter, select it in the list and click Edit. In the Edit Coverage Filter dialog that appears, make necessary changes as described for adding a new filter below.
- Click Save to save and apply your modifications, if any.
Solution-wide filters are saved in the Solution team-shared settings layer and, therefore, can be shared within other developers who work on this solution. For more information, see Sharing Coverage Filters.
- In the Coverage Filters dialog, click Add filter.
In the Add Coverage Filter
dialog that appears, choose the type of filter rule:
- Analyze code in - to include the specified code item into code coverage analysis and exclude all other code items.
- Do not analyze code in - to exclude the specified code item from code coverage analysis.
- Do not analyze code marked with attribute - to exclude code items with the specified attribute from code coverage analysis.
- If you have chosen one of the first two options, specify an assembly, a class, and/or a method to be included or excluded in the coverage analysis. Code items are filtered independently on one another. For example, if you specify a method and leave asterisks (*) for assembly and class to exclude methods with the specified name from all assemblies and all classes.
- If you have chosen the last option, specify the name of the attribute that will be used to exclude symbols from the coverage analysis. Optionally, specify the assembly name where this attribute is declared.
- In the Apply filter to section, specify the scope of the filter: All solutions or Current solution.
- Click OK to finish adding the filter.
- In the Coverage Filters dialog, click Save to save and apply your modifications.
You can use asterisk wildcards when specifying code item names in a filter:
'*' (asterisk) represents zero or more characters.
For example, you can use the *.Tests wildcard that will exclude all test projects from code analysis.