20.6. Managing Large Numbers of Tests

Visual Studio provides both the Test View window and the Test List Editor to display a list of all of the tests in a solution. The Test View window, which was shown earlier in the chapter in Figure 20-2, simply displays the unit tests in a flat list. However, if you have hundreds, or even thousands, of unit tests in your solution, then trying to manage them with a flat list will quickly become unwieldy.

The Test List Editor enables you to group and organize related tests into test lists. Since test lists can contain both tests and other test lists, you can further organize your tests by creating a logical, hierarchical structure. All the tests in a test list can then be executed together from within Visual Studio, or via a command-line test utility.

The Test List Editor can be opened from the Test Windows menu, or you can double-click the Visual Studio Test Metadata (.vsmdi) file for the solution. Figure 20-9 shows the Test List Editor for a solution with a number of tests organized into a hierarchical structure of related tests.

Figure 20.9. Figure 20-9

On the left in the Test List Editor window is a hierarchical tree of test lists available for the current solution. At the bottom of the tree are two project lists, one showing all the test cases (All Loaded Tests) and one showing those test cases that haven't been put in a list (Tests Not in a List). Under the Lists of Tests node are all the test lists created for the project.

To create a new test list, click Test Create New Test List. Test cases can be dragged from any existing list into the new list. Initially, this can be a little confusing because a test will be moved to the new list and removed from its original list. To add a test case to multiple lists, either hold the Ctrl key while dragging the test case or copy and paste the test case from the original list to the new list.

After creating a test list, you can run the whole list by checking the box next to the list in the Test Manager. The Run button executes all lists that are checked. Alternatively, you can run the list with the debugger attached using the Debug Checked Tests menu item.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.212.102