
(Optional) Create a Test List
Test Lists are a way of collecting unit tests into logical groups. The main advantages to adding unit tests to a test list is that you can run tests from multiple unit test files, you can run them as part of a build, and you can use the lists to enforce a check-in policy. For more information about Test Lists, see Using Test Lists.
To create a test list
On the Test menu, click Create New Test List. The Create New Test List dialog box opens on top of the Test List Editor window.
In the Create New Test List dialog box, type a name for the list, add a description, select where you want the test list to reside, and then click OK.
To display the available tests, in the Test List Editor window, click All Loaded Tests.
Drag each unit test that you want to add from the main window onto your test list.
Run a unit test
After your unit tests are created, you can run them any time that you want. This procedure provides one way to run unit tests, but for more information about alternative methods, such as using keyboard shortcuts or the command line, and see How to: Run Selected Tests.
To run a unit test
On the Test menu, point to Windows, and then click Test View.
(Optional) If you want to collect code coverage information, do the following:
On the Test menu, point to Edit Test Run Configurations, and click the configuration for your current test run.
In the <testrunname>.testrunconfig dialog box, click Code Coverage in the list and then select the check box or boxes to select items for which to collect code coverage information.
Click Close.
In the Test View window, select one or more tests. To select multiple tests, hold the CTRL key while you click tests.
Click the Run Selection button on the Test View window toolbar. The tests run and the Test Results window opens.
(Optional) To see details about a test, double-click the test in the Test Results window.
(Optional) To locate the area of your unit test file that contains an error, in the Error List, double-click the error.
For more information about understanding your test results, see Obtaining Test Results.