dotCover 2018.1 Help

コードカバレッジの可視化

ReSharper | カバー | Toggle Code Highlighting
Ctrl+Alt+K H
ReSharper_ToggleHighlighting

To visualize coverage and test results data, dotCover can highlight statements in the current snapshot right in Visual Studio editor.

To visualize code coverage in the editor

  1. Open the snapshot that you want to analyze in the カバレッジ結果ブラウザウィンドウ or in the ユニットテストカバレッジ window..
  2. Click ハイライトコード ThemedIcon Highlighting Screen Gray on the toolbar of the window where the current snapshot is open.
  3. dotCover will highlight code in all assemblies that are included into the current coverage snapshot (see the left gutter):
    dotCover highlighting
  4. To disable highlighting of the current snapshot, press Ctrl+Alt+K H or choose ReSharper | カバー | Toggle Code Highlighting from the main menu

If you switch between several snapshots in the カバレッジ結果ブラウザウィンドウ or in the ユニットテストカバレッジ window., the highlighting does not switch automatically. To switch the highlighting for a particular snapshot, click ハイライトコード ThemedIcon Highlighting Screen Gray on the toolbar of the window where the current snapshot is open.

ハイライトの仕組み

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

マーカー説明
dc highlighting no tests | dc highlighting no tests shapedAt least one statement in a line is not covered by unit tests.
dc highlighting tests passAll statements in a line are covered by unit tests. All tests pass.
dc highlighting tests fail | dc highlighting tests fail shapedAll statements in a line are covered by unit tests. At least one test fails.

Note that if you enable the Use shaped markers (colorblind mode) setting in dotCover's highlighting options , markers will indicate coverage and test results not only with color but also with their shape.

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:

dc highlighting previous state

If a line of code consists of a number of statements with different coverage results, dotCover will highlight the line taking into account only the "worst" result. For example, if tests for the first statement pass, but fail for the second, dotCover will highlight the line with the red color. Or, if one statement is covered by some failing tests and another statement is not covered at all, the marker will be grey:

dc highlighting multiple

If you prefer the "old-style" highlighting (as in dotCover 2016.2 and earlier) when a whole line of code was highlighted, you can toggle it via ReSharper | オプション | dotCover | エディター | Highlighting code coverage using | Line background .

dc old highlighting

テストをカバーする方法に移動する方法

To continue exploring code coverage, you can navigate to covering tests and/or locate code items in the coverage tree .

最終変更日: 2018年4月16日

関連事項