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 pop-up that lists covering tests and navigate directly to any of these tests. Additionally, from this pop-up 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 pop-up 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 pop-up 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.
To navigate to covering tests
- In the editor, place the caret at a code statement.
- Ctrl+Alt+K T を押すか、メインメニューから を選択してください。または、 Ctrl+Shift+Aを押して、ポップアップでコマンド名を入力してから、コマンド名を選択することもできます。
- 以下のいずれか 1 つを実行します
- Ctrl+Alt+K T を押すか、メインメニューから を選択してください。
- If 強調表示 is enabled, hold the cursor on a particular highlighting marker until a tooltip appears. Click on the tooltip.
- In the pop-up that appears, you will see the list of unit tests that cover the statement.
- Double-click on the desired unit test to open it in the editor.