https://msdn.microsoft.com/en-us/library/ms182470.aspx
Running Automated Tests in Visual Studio
Visual Studio provides different ways to run tests. You can choose the way that best suits your current needs:
-
Run Tests From Test Explorer. You can run automated tests including unit, coded UI, ordered, and generic in your solution from Test Explorer. Test Explorer easily lets you run and monitor the status of all the automated tests in your solution.
-
Run load tests from the load test editor. Load tests and web performance tests are run from either the Load Test Editor, the Web Performance Test Editor, or from the Visual Studio Enterprise LOAD TEST menu. For more information, see Running Load and Web Performance Tests.
-
Run Tests From Your Source Code Files. By using the keyboard, you can run tests from any text-based file in your solution. In particular, you can run tests while editing a file that contains your code under test. This lets you change source code and immediately test it without using a window or a menu.
-
Run Tests From Files in Your Test Code Files. By using the mouse or the keyboard, you can run tests from the file that contains your test code. This lets you change a test and then run it immediately without using a window or a menu.
TestExplorer在菜单中的位置Test-->Windows-->TestExplorer
To run tests from Test Explorer
-
In Test Explorer, choose Run All. Or, select the tests you want to run, right-click, and then choose Run Select Tests.
The automated tests will run and indicate if they passed or failed.
You can also choose the drop-down list under Run for other options including Run Failed Tests, Run Not Run Tests, Run Passed Tests,Repeat Last Run, and Analyze Code Coverage.
To view Test Explorer from the Test menu, point to Windows and then choose Test Explorer.