dotCover 2023.3 Help

What is Coverage Snapshot?

dotCover records and stores coverage analysis data in coverage snapshots.

A coverage snapshot is a data unit containing code coverage statistics for all assemblies that were involved in a coverage run and had source code or PDB files available during the test run. Coverage snapshots are saved in files with the *.dcvr extensions and can be opened later with Visual Studio (with dotCover installed) or with dotCover standalone application.

For coverage of unit tests and coverage of tests on server side, assemblies that contain unit tests are also included in the coverage snapshot.

Each item within the snapshot has its own percentage of statement coverage calculated as a ratio of the number of covered statements to the total number of statements. The coverage is rounded to the nearest whole percent.

Once you open a coverage snapshot from a file or finish a coverage test run, the snapshot is visually displayed in the Coverage Results Browser window or in the Unit Test Coverage window .

Per-test data

When you run coverage analysis of unit tests on a local machine, dotCover records per-test data (that is, which test executes which statements) into the coverage snapshot. When analyzing coverage results, this information allows you to navigate to covering tests.

In certain cases, this information is not recorded in the snapshot:

  • The snapshot was obtained during an application coverage run

  • The snapshot was obtained with the command-line tool.

  • The snapshot was obtained when covering MsTests and the test run configuration was specified in a legacy .testsettings file. (In the current versions of Visual Studio it is recommended to use .runsettings file for configuring unit tests.)

Per-test data also affects the way the new snapshot is merged with the currently opened snapshot when you run a single test in the Unit Test Sessions window. If the current snapshot has per-test data, the snapshot that you get after rerunning a single unit test will contain information on all unit tests. Otherwise, the resulting snapshot will only have the information on the latest executed test.

Another thing that you should consider is that dotCover records local paths to assemblies and source files in coverage snapshots. If you open a snapshot recorded in another computer and want to visualize code coverage in files and navigate to covering tests, dotCover will try to remap the paths.

Last modified: 01 December 2023