dotCover 2024.3 Help

Navigate to Covering Tests

dotCover provides a shortcut to detect which unit tests cover a particular statement in your code. In the Visual Studio editor, you can invoke a popup that lists covering tests and navigate directly to any of these tests. Additionally, from this popup you can instantly run them or add to an existing unit test session.

dotCover takes the information on the covering unit tests from the current coverage snapshot. Therefore, in some cases this information may be unavailable, and dotCover cannot perform this navigation:

  • No coverage snapshot is open. In this case, the corresponding commands in the main and context menus are grayed out.

  • No unit tests cover the current statement. In this case, the commands are active but the popup will show the following message: No tests cover this statement.

  • The current snapshot has no per-test data. In this case, the commands are active but the popup will show the following message: Current snapshot does not contain per-test info.

It is obvious that for the code not covered with unit tests, this navigation is impossible. Therefore, you can first highlight covered code and then navigate from the code highlighted as covered.

Navigate to covering tests. Option 1

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

  2. Do one of the following:

    • Press Control+Alt+K T or choose ReSharper | Cover | Show Covering Tests from the main menu .

    • If the coverage highlighting is enabled, hover over a particular highlighting marker until a tooltip appears, and then click the tooltip.

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

    dotCover: A popup with unit tests that cover the statement
  4. Double-click the desired unit test to open it in the editor.

Navigate to covering tests. Option 2

  1. In the Unit Test Coverage window, find the required class or class member.

  2. In the context menu, select Show Covering Tests.

    Show covering tests
  3. Double-click the desired unit test to open it in the editor.

Navigate to covering tests. Option 3

  1. In the document, right-click the dotCover shield icon.

    Show covering tests
  2. Select Show Covering Tests.

  3. Double-click the desired unit test to open it in the editor.

Last modified: 23 September 2024