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:
Deployment enabled? |
Gather code-coverage data? |
Instrument binaries in which folder? |
See this section: |
No |
Not applicable |
Not applicable |
Deployment not Enabled |
Yes |
No |
Not applicable |
Code Coverage Data Not Requested |
Yes |
Yes |
In place |
Code Coverage Requested: Instrument In-Place |
Yes |
Yes |
In deployment folder |
Code Coverage Requested: Instrument in Deployment Folder |
Deployment Not Enabled
If you have chosen not to enable deployment, Visual Studio performs the following steps:
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. For more information, see How to: Specify a Test Run Configuration.
Run tests and produce test results. This includes writing results to the test results file.
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.
Note
When test deployment is disabled, you cannot gather code coverage data. Also, you cannot run smart device tests. For information about how to enable and disable test deployment, see How to: Configure Test Deployment.
Code Coverage Data Not Requested
If you have chosen not to gather code-coverage data, Visual Studio performs the following steps:
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 the Local Deployment Folders section in Test Deployment Overview.
Copy deployment files. Copy all deployment files and folders to the deployment folder.
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.
Run tests and produce test results. This includes writing results to the test results file.
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:
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.
Re-sign assemblies. If a strong-named assembly has been instrumented, re-sign it now. For more information, see Instrumenting and Re-Signing Assemblies.
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 the Local Deployment Folders section in Test Deployment Overview.
Copy deployment files. Copy all deployment files and folders to the deployment folder.
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.
Run tests and produce test results. This includes writing results to the test results file and to a code coverage file.
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.
Restore the original files that were changed during in-place instrumentation.
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:
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 the Local Deployment Folders section in Test Deployment Overview.
Copy deployment files. Copy all deployment files and folders to the deployment folder.
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.
Re-sign assemblies. If a strong-named assembly has been instrumented, re-sign it now. For more information, see Instrumenting and Re-Signing Assemblies.
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.
Run tests and produce test results. This includes writing results to the test results file and to a code coverage file.
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
Tasks
How to: Configure Test Deployment
How to: Limit the Number of Stored Test Runs