Sdílet prostřednictvím


How to: Organize Tests into Test Lists

You can use Microsoft Visual Studio 2010 to create groups of tests that persist. These groups of tests are called test lists. You create and manipulate test lists in the Test List Editor.

The following procedures describe how to work with tests and test lists.

Poznámka

To change the way tests are displayed in the Test List Editor, without creating or changing test lists, use the Group By feature.

To add tests into test lists

  1. Open the Test List Editor.

  2. If the test list you want does not already exist, create it. For more information, see How to: Create a Test List.

  3. To see all your tests listed in the Test List Editor, click the All Loaded Tests node in the test list pane.

  4. Select tests in the Test List Editor. For more information, see How to: Run Automated Tests from Microsoft Visual Studio.

  5. Drag the selected tests from the Test List Editor into the test list.

Poznámka

Only one instance of a test can exist in a test list. You cannot drag a test a second time into the same test list.

To move or copy tests between test lists

  1. Open the Test List Editor.

  2. In the test list pane, click a test list.

    The list's tests appear in the contents pane of the Test List Editor.

  3. Drag a test from the contents pane of the Test List Editor to the destination test list, in the test list pane.

    This removes the test from the source test list and adds it to the destination list.

    Poznámka

    A test can exist in more than one test list. To copy a test to a new list without removing it from the original list, press the CTRL key while dragging the test. Regardless of the number of test lists that contain a test, all instances of the test refer to the same test method.

  4. Alternatively, you can move or copy tests by using the Cut, Copy, and Paste commands. First, right-click a test and then click Cut or Copy. Then, either switch to the destination node or test list and click Paste, or click the name of the node or test list in the test list pane and then click Paste. The test is then moved or copied to the destination node, such as All Loaded Tests, or test list.

To remove tests from a test list

  1. Open the Test List Editor.

  2. Highlight the test list that contains the test or tests you want to remove.

  3. Right-click the test that you want to remove, and then click Remove from Test List.

    The test is removed from the list, but it is not deleted from the test project, nor is the list affected in any other way. You can always locate any test in the All Loaded Tests folder, regardless of whether it is present in one or more lists.

    Poznámka

    You cannot remove tests from the All Loaded Tests node or from the Tests Not in a List node.

See Also

Tasks

How to: Create a Test List