Set up coverage filters
Coverage filters let you control which assemblies and symbols are included in or excluded from coverage analysis. Filters help you:
Reduce analysis time by skipping irrelevant code.
Focus results on your project or working area.
Exclude test helpers, third-party libraries, or generated code.
Filter types:
- Runtime coverage filters
JetBrains Rider applies these filters during a coverage session. Use these filters to exclude unnecessary code from analysis and reduce coverage session time.
You can configure runtime filters in JetBrains Rider settings or using the command line.
- Filters of coverage results
JetBrains Rider applies these filters to coverage results (coverage tree) after the coverage session is over. Use them to exclude nodes you don't want to see at the moment. Learn more
Apply runtime coverage filters
Use JetBrains Rider settings to specify runtime coverage filters for a specific namespace or attribute.
As filters are applied in runtime, JetBrains Rider does not include the filtered items in the coverage snapshot and does not show them in the Unit Tests Coverage window.
Add a runtime coverage filter
Open the filter settings page in Rider settings: .
In Runtime coverage filters, click
Add ... next to the required filter rule:Do not analyze code in assemblies – exclude specific assemblies (e.g.
*.Tests). This is useful for test utilities or external SDKs.Do not analyze code marked with attributes – exclude classes, methods, or properties marked with a specific attribute. Specify a fully qualified attribute name, for example,
System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttributeor*.ExcludeFromCodeCoverageAttribute.
You can use asterisk wildcards when specifying code item names in a filter:
*(asterisk) represents zero or more characters.Click Save.
Apply filters to coverage results
JetBrains Rider applies these filters to coverage results after a coverage session is over. Use result filters to temporarily hide items from the coverage tree in the UI. These filters do not affect analysis or the generated snapshot.
Exclude a node (namespace, class, class member) from coverage results
Open the Unit Tests Coverage window.
Select a node and in the context menu select:
Exclude from Coverage Results to exclude the node from the current results.
Exclude All But This to leave only the selected node in the coverage tree.
Show the excluded nodes back
Click the Show all nodes link on top of the Unit Tests Coverage window.