Steps in a Test Run

When a test run starts, Visual Studio performs several steps. These steps are described in one of the sections listed in the following table, depending on the settings in the run configuration of your tests:

Gather code-coverage data?

Instrument binaries in which folder?

See this section:

No

Not applicable

Code Coverage Data Not Requested

Yes

In place

Code Coverage Requested: Instrument In-Place

Yes

In deployment folder

Code Coverage Requested: Instrument in Deployment Folder

Code Coverage Data Not Requested

If you have chosen not to gather code-coverage data, Visual Studio performs the following steps:

  1. Create deployment folder. Create a set of folders that will be used for the test run. For more information about this step for local test runs, see Local Deployment Folders.

  2. Copy deployment files. Copy all deployment files and folders to the deployment folder. For more information, see Deploying Files and Folders.

  3. Run setup scripts, if any. A setup script assigns values to environment variables to determine aspects of the test run, such as the name of the folder in which to save test results. The setup script itself resides in the root deployment folder. For more information, see How to: Specify a Test Run Configuration.

  4. Run tests and produce test results. This includes writing results to the test results file.

  5. Run cleanup scripts, if any. You can indicate both setup scripts and cleanup scripts in run configuration. For more information, see How to: Specify a Test Run Configuration.

Code Coverage Requested: Instrument In-Place

If you have chosen to gather code-coverage data and to instrument binaries in place, Visual Studio performs the following steps:

  1. Instrument binaries for code coverage. This occurs in the folder where the binaries have been created, before they are deployed. For more information, see How to: Obtain Code Coverage Data.

  2. Re-sign assemblies. If a strong-named assembly has been instrumented, re-sign it now. For more information, see Instrumenting and Re-Signing Assemblies.

  3. Create deployment folder. Create a set of folders that will be used for the test run. For more information about this step for local test runs, see Local Deployment Folders.

  4. Copy deployment files. Copy all deployment files and folders to the deployment folder. For more information, see Deploying Files and Folders.

  5. Run setup scripts, if any. A setup script assigns values to environment variables to determine aspects of the test run, such as the name of the folder in which to save test results. The setup script itself resides in the root deployment folder. For more information, see How to: Specify a Test Run Configuration.

  6. Run tests and produce test results. This includes writing results to the test results file and to a code coverage file.

  7. Run cleanup scripts, if any. You can indicate both setup scripts and cleanup scripts in run configuration. For more information, see How to: Specify a Test Run Configuration.

  8. Restore the original files that were changed during in-place instrumentaion.

Code Coverage Requested: Instrument in Deployment Folder

If you have chosen to gather code-coverage data but not to instrument binaries in place, Visual Studio performs the following steps:

  1. Create deployment folder. Create a set of folders that will be used for the test run. For more information about this step for local test runs, see Local Deployment Folders.

  2. Copy deployment files. Copy all deployment files and folders to the deployment folder. For more information, see Deploying Files and Folders.

  3. Instrument binaries for code coverage. This occurs in the folder to which the binary has been copied. For more information, see How to: Obtain Code Coverage Data.

  4. Re-sign assemblies. If a strong-named assembly has been instrumented, re-sign it now. For more information, see Instrumenting and Re-Signing Assemblies.

  5. Run setup scripts, if any. A setup script assigns values to environment variables to determine aspects of the test run, such as the name of the folder in which to save test results. The setup script itself resides in the root deployment folder. For more information, see How to: Specify a Test Run Configuration.

  6. Run tests and produce test results. This includes writing results to the test results file and to a code coverage file.

  7. Run cleanup scripts, if any. You can indicate both setup scripts and cleanup scripts in run configuration. For more information, see How to: Specify a Test Run Configuration.

See Also

Concepts

Test Deployment Overview
Instrumenting and Re-Signing Assemblies
Choosing the Instrumentation Folder