JetBrains Rider 2021.2 Help

Work with coverage results

No matter what type of coverage analysis you perform, coverage of unit tests, or coverage of an application, dotCover saves coverage results in a coverage snapshot. You can then further investigate these results using the editor and the Unit Tests Coverage window.

Visualize code coverage in the editor

  1. After you finish a coverage session, Rider will open the Unit Tests Coverage window.

  2. Click Highlight code Highlight code on the toolbar of the window.

  3. dotCover will highlight code in all assemblies that are included into the current coverage snapshot (see the gutter):

    JetBrains Rider: Coverage highlighting

To indicate the state of the code statement, dotCover uses colored markers in the gutter:

Marker

Description

Highlighting no tests | Highlighting no tests

At least one statement in a line is not covered by unit tests.

Highlighting tests pass

All statements in a line are covered by unit tests. All tests pass.

Highlighting tests fail | Highlighting tests fail

All statements in a line are covered by unit tests. At least one test fails.

Right after you change the code, test results become outdated. In this case, a marker keeps its color but it becomes paler. The marker's tooltip shows the info about previous state as well:

Coverage highlighting outdated
  1. In the editor, place the caret at a code statement.

  2. Make sure the highlighting is enabled and hold the cursor on a particular highlighting marker until a tooltip appears. Then click the tooltip.

  3. In the popup that appears, you will see the list of unit tests that cover the statement.

    Navigate to covering test
  4. Double-click the desired unit test to open it in the editor.

When working in the editor, you can quickly locate code symbols (types, methods, and so on) in the code coverage tree. This may be helpful if you want to see how well a code symbol is covered in the current snapshot.

  1. In the editor, place the caret at a code symbol that you want to locate in the coverage tree.

  2. In the Unit Tests Coverage window, click Navigate from Editor Navigate to coverage tree.

  3. The symbol will be located in the current tree.

Search the coverage tree

The coverage tree displayed in the Unit Tests Coverage window provides a quick-search option for all items included in the tree.

  1. Open the Unit Tests Coverage window.

  2. In the search field, start typing your search string.

  3. Start typing a search string.

  4. The Search box will appear under the toolbar displaying your search string and the coverage tree will be filtered according to the search string.

    Search coverage tree

Note that applying search filters does not recalculate total coverage.

Export coverage results

dotCover helps process coverage data the way you need. Exporting to several formats, including HTML, XML, JSON, and XML for NDepend enables you to share coverage reports with the rest of the team or pass coverage information to external services.

  1. In the Unit Tests Coverage window, click Export coverage report Export coverage report.

  2. In the list that opens, choose a format for export.

  3. In the dialog that appears, specify a filename and location to which the report should be saved.

Last modified: 19 August 2021