How to: Rerun a Test
You can rerun all tests or a selection of the tests that were run in the last test run. If.you modify the tests or the code under test, you can choose to run either the original code or the re-compiled code when you re-run your tests.
To rerun a test run using the Test Results window
After you run one or more tests, the Test Results window displays a row for each test that was run. In the Test Results Window, the check box of each test that did not produce a Passed result is automatically checked. You can select additional tests in the Test Results window, or clear tests that you do not want to run again.
(Optional) Change the code you tested, the code of the tests you ran, or settings in the active test settings. For more information about how to change test settings, see Create Test Settings to Run Automated Tests from Visual Studio.
If you changed neither code nor test settings, you can rerun your tests by clicking the down arrow next to the Run button and then clicking either Run Checked Tests or Run Checked Deployed Tests. If you did make changes, go to the following step.
If you changed code or test settings, you can still rerun the tests in their original versions. To do this, click the down arrow next to the Run button and then click Run Checked Deployed Tests.
The Run Checked Deployed Tests option is not available if test deployment is disabled. For more information, see How to: Configure Test Deployment.
If you changed code or test settings, you can run the latest versions of the tests and code under test while using the latest test settings. To do this, click the down arrow next to the Run button and then click Run Checked Tests. This rebuilds changed projects and then runs the rebuilt versions of the test and the code under test.
To rerun tests in other ways
Run one or more tests.
(Optional) Change the code that you tested or the code of the tests that you ran.
The tests that you ran remain selected. This means that you can run them in any of the ways described in How to: Run Automated Tests from Microsoft Visual Studio. These methods include the following:
In the file that contains the source code of your tests, right-click and then click Run Tests.
In the Test View window click Run Selection.
In the Test List Editor Run Checked Tests.
Before the tests are run, any projects with changed code are rebuilt.
If you changed the code under test or the code of your tests, this action does not rerun the same versions of that code that you ran the previous time. It runs the latest, rebuilt, versions of the test and the code under test.