Export (0) Print
Expand All

How to: Run Selected Tests

The Team System testing tools offer several ways to run tests, from both the Visual Studio integrated development environment (IDE) and at a command prompt.

For more information about how to run tests at a command prompt, see Command-Line Test Execution.

NoteNote

When you run one or more tests in Visual Studio, if the test contents are new or changed and have not been saved, they are automatically saved before the test is run. Similarly, if the code of a unit test has been edited but the project that contains the test has not been re-built, Visual Studio builds the project before running the test.

In the following procedures, you sometimes select items and sometimes check them. For more information, see Selecting Tests.

To run a single test

  • Right-click the test in the Test View window and then click Run Selection.

    - or -

    Select the test in the Test View window and then click Run Selection on the Test View toolbar.

    - or -

  • In the Test Manager window, check a test. Then, either

    • click Run Checked Tests on the Test Manager toolbar

      - or -

    • right-click the surface of the window and click Run Checked Tests.

    NoteNote

    To make sure only the one test is selected, first click [All Loaded Tests] in the test lists pane. This view shows all the tests that are currently selected in all test lists.

    - or -

  • In the Test Manager window, put a check mark by a test list that contains only the test you want to run, and then click Run Tests on the Test Manager toolbar.

    NoteNote

    To make sure only the one test is selected, first click [All Loaded Tests] in the test lists pane. This view shows all the tests that are currently selected in all test lists.

    - or -

  • In the Test Results window, with one test result checked, click Rerun on the Test Results window status bar. For more information, see How to: Rerun a Test.

To run multiple tests

  • In the Test View window, select the tests you want to run and then click Run Selection on the Test View toolbar.

    - or -

  • In the Test View window, select the tests you want to run, right-click, and then select Run Selection.

    - or -

  • In the Test Manager window, with multiple tests checked, right-click the surface of the window and click Run Checked Tests, or click Run Checked Tests on the Test Manager toolbar.

    NoteNote

    To identify which tests are selected, first click [All Loaded Tests] in the test lists pane. This view shows all the tests that currently are selected in all test lists.

    - or -

  • In the Test Manager window, put a check mark by a test list that contains the tests you want to run, and click Run Checked Tests on the Test Manager toolbar.

    NoteNote

    If you select a test list in the test lists pane, only the tests it contains are displayed in the Test Manager window. If you now run this test list, you might notice that one or more tests not in this list also run. This behavior occurs because Team Edition for Testers runs any test in the solution that is selected. To identify which tests are selected, click [All Loaded Tests] in the test lists pane. This view shows all the tests that currently are selected in all test lists.

    - or -

  • In the Test Results window, with multiple tests checked, click the Run button or click Rerun on the Test Results window status bar.

    - or -

  • At a command prompt, run a test list that contains the tests you want to run, or run specific tests. For more information, see Command-Line Test Execution.

To run a test project

  1. Your test project must be the startup project in your solution. To do this, in Solution Explorer, right-click the test project and then click Set as StartUp Project.

    Solution Explorer indicates the test project as the startup project by displaying its name in bold text.

  2. Start your project. Do this by selecting Start Debugging or Start Without Debugging on the Debug menu, or by pressing the corresponding key combinations, F5 and Ctrl+F5. You can also do this by clicking Start Debugging (F5) on the Standard toolbar.

    All the tests in the test project are run.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft