How to: Create an Ordered Test

 

An ordered test is a container that holds other tests and guarantees that tests run in a specific order.

Requirements

  • Visual Studio Enterprise, Visual Studio Test Professional

Warning

In an ordered test, each test is self-contained and independent. So the environment state is not retained between each test that is run.

Note

Before you start this procedure, you must have other tests available to include in the ordered test.

To create an ordered test

  1. In Solution Explorer, open the shortcut menu on a unit test project or a coded UI test project, choose Add, and then choose Ordered Test.

    The ordered test opens in the main document editing window. You will use this window to select and include tests in the new ordered test.

  2. (Optional) Change the selection of tests to choose from. Choose the down arrow under Select project to view tests, and then choose the test project in your solution.

  3. Under Available tests, choose a test to select it. You can select multiple tests by using SHIFT+click and CTRL+click.

  4. To move the test or tests into the ordered test, choose the right arrow.

    Note

    You can add the same test multiple times to the same ordered test. When you do this, the test will be run as many times as it appears in the ordered test, in the order listed.

    To remove a test from the ordered test, choose the test in the Selected tests pane and then choose the left arrow. To remove multiple tests at one time, select them by using SHIFT+click or CTRL+click, and then choose the left arrow.

  5. (Optional) Re-order the tests within the ordered test by choosing a test in the Selected tests pane and then choosing the up or down arrow. To re-order multiple tests at one time, select them by using SHIFT+click or CTRL+click, and then choose the up or down arrow.

    Note

    Checking Continue after failure means that the ordered test will run regardless of the failure of one or more tests. Leaving Continue after failure unchecked means that the ordered test will stop running after the first occurrence of a test failure.

The ordered test is ready to run. For more information about how to run tests, see How to: Run Tests from Microsoft Visual Studio.

See Also

How to: Run Tests from Microsoft Visual Studio