Udostępnij za pośrednictwem


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

  1. 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.

  2. (Optional) Change the code you tested, the code of the tests you ran, or settings in the active test run configuration. For more information about how to change test run configuration settings, see How to: Specify a Test Run Configuration.

  3. If you changed neither code nor test run configuration 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.

  4. If you changed code or test run configuration 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.

    Note

    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 run configuration settings, you can run the latest versions of the tests and code under test while using the latest run configuration 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

  1. Run one or more tests.

  2. (Optional) Change the code that you tested or the code of the tests that you ran.

  3. The tests that you ran remain selected. This means that you can run them in any of the ways described in How to: Run Selected Tests. 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 EditorRun Checked Tests.

    Before the tests are run, any projects with changed code are rebuilt.

    Note

    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.

See Also

Tasks

How to: Run Selected Tests