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 Premium and Visual Studio Ultimate help 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 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 Excel Report.
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
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.
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 is listed. You can make more runs available by importing them. For more information, see How to: Save and Open Test Results in Visual Studio.
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.
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.
To view merged results, expand the Merged Results node in the Code Coverage Results window.
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.