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.
Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional
In an ordered test, each test is self-contained and independent. Therefore, the environment state is not retained between each test that is run. Do not use an ordered test in which any of the tests have dependencies on the outcome of previous tests in the ordered test.
Before you start this procedure, you must have other tests available to include in the ordered test.
To create an ordered test
In Solution Explorer, open the shortcut menu for 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.
(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.
Under Available tests, choose a test to select it. You can select multiple tests by using SHIFT+click and CTRL+click.
To move the test or tests into the ordered test, choose the right arrow.
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.
(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.
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.