Udostępnij za pośrednictwem


How to: Merge Code Coverage Data

You might have run tests in multiple test runs on your production code and you want to determine how fully that code has been tested. Or, various testers working on a large project might have been testing different areas and you want to gather code coverage statistics for the entire project to view it all together.

Visual Studio Team System Test Edition helps you accomplish this by merging multiple sets of code coverage data, as described in Merging Code Coverage Data.

You can also work with code coverage data in other ways, such as by saving merged data to disk and re-importing it to view it later. To read about other aspects of working with merged code coverage data, see Working with Merged Code Coverage Data.

Viewing Merged Code Coverage Data in Team Foundation Server

This topic describes how to use Test Edition to merge code coverage data and view that merged data. You can also view merged code coverage data that has been published to Team Foundation Server. For more information, see Code Coverage Perspective and Overview of Build Reports.

Merging Code Coverage Data

Prerequisite: You have run tests that have produced code coverage data, as described in "Obtaining Code Coverage Data" in How to: Obtain Code Coverage Data.

To merge code coverage data

  1. Click Windows on the Test menu, and then click Code Coverage Results. Alternatively, on the Test Results toolbar, click Code Coverage Results.

    The Code Coverage Results window opens.

  2. Click Merge Results.

    The Merge Test Runs dialog box displays test runs that are available for merging. All test runs that are currently in memory that contain code coverage data are listed. You can make more runs available by importing them. For more information, see How to: Import Test Results.

  3. Under Select coverage results to merge, select the results you want to merge, and then click OK.

    The selected sets of code coverage results merge.

    Note

    If you change your production code between tests, you cannot merge results from testing the original code with results from testing the changed code. Merging results will sometimes fail if you have recompiled your production code between the tests whose results you want to merge.

  4. To view merged results, expand the Merged Results node in the Code Coverage Results window.

  5. All merged results appear under the Merged Results node. Each time you merge test results, the new set of results replaces all previously displayed merged results.

See Also

Tasks

How to: Obtain Code Coverage Data

Concepts

Instrumenting and Re-Signing Assemblies

Working with Merged Code Coverage Data

Code Coverage Perspective

Overview of Build Reports