Поделиться через


Configuring Code Coverage

Team Edition for Testers can gather code coverage data when it runs tests, and it presents this data to you in different ways, statistically and graphically. You can change certain aspects of the way code coverage data is gathered and displayed.

Gathering Code Coverage Data

To obtain code coverage data, the assembly being tested must first be instrumented. You can choose whether to have assemblies instrumented in their original folder, or in the folder to which they are deployed for testing. If you are working with signed assemblies, you can make decisions about the re-signing that occurs after they are instrumented on the Code Coverage page of the test run configuration editor, as described in Instrumenting and Re-Signing Assemblies. For more information about the sequence of deployment steps, see Steps in a Test Run.

Display of Code Coverage Data

Data that is presented statistically is displayed in the Code Coverage Results window. For more information, see "Viewing Code Coverage Data" in How to: Obtain Code Coverage Data.

Graphical presentation displays lines of code that have been exercised in a different color than lines of code that have not been exercised. You can choose to enable source-code coloring by default in the Options dialog box opened on the Tools menu of Visual Studio. To find this setting, look on the Test Execution page under the Test Tools node. You can also change the colors used to show code coverage. For more information, see the section "Changing the Display of Code Coverage Data" in How to: Obtain Code Coverage Data.

How to: Obtain Code Coverage Data

Instrumenting and Re-Signing Assemblies

Testing Web Sites and Web Services in a Team Environment