Running Automated Tests
After you have created any one of the following types of automated tests by using Visual Studio, you can then run the tests.
Unit tests.
Coded UI tests.
Load tests.
Generic tests.
Many methods of running your automated tests are available, depending on how you want to run tests and view the results. If you run your automated tests by using a test plan, you can view your testing progress and easily rerun your tests as required. To run your automated tests by using a test plan, you associate your automated tests with test cases and run these test cases by using Microsoft Test Manager, tcm.exe, or a build-deploy-test workflow. To run your automated tests in this manner, you must create a lab environment to use when you run your tests. For more information about how to create lab environments to use to run your tests, see Using a Lab Environment for Your Application Lifecycle.
Requirements
- Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional
Note
It is not a good idea to run load tests by using Microsoft Test Manager because you cannot view the test as it runs. It is useful to be able to do this for load tests.
A lab environment enables you to run tests, gather data, or perform system actions on machines for each specific role that you add to the environment. A role specifies the purpose of a machine in the environment. For example, a specific role could be called "Web Site for Customer Data Store." A machine can be a physical computer or a virtual machine. You select which machines to use in an environment for each role.
For example, you could run your tests on one machine and gather system information about a machine that runs the Web server for your application. Alternatively, you could run your tests on an environment that uses multiple machines and collect test impact data on those machines. In addition, you can also perform network emulation on the machine that runs the Web server for your application.
The following illustration shows three examples of scenarios for how you can set your test settings to run your tests by using lab environments from Microsoft Test Manager.
This method of running automated tests lets you view the overall status of any tests in your test plan. You can view the results of both manual and automated tests together, if you want. You can also run these test cases by using associated automation from the command line.
You can also run your tests directly from Visual Studio or the command line without being part of a test plan or without using an environment to run them remotely. In addition, if you add your automated tests to a test category, your automated tests can be run automatically as part of the build process.
Note
To take advantage of the multiple processors in a multiprocessor machine, you must run your tests by using test agent controllers and test agents. Otherwise, if you run your tests locally, you will not use this additional processing power. For more information, see Setting Up Test Machines to Run Tests or Collect Data.
Tasks
Use the following topics to help you run automated tests.
Tasks |
Associated Topics |
---|---|
Running automated tests remotely as part of a test plan: You can run automated tests as part of a test plan if you associate your automated tests with test cases. |
|
Running automated tests locally or remotely from Microsoft Visual Studio: You can run automated tests locally from Visual Studio. Or you can run your automated tests remotely by using test agent controllers and test agents. |
|
Running automated tests from the command line: You can run automated tests locally from the command line by using mstest.exe. Or you can run your automated tests remotely from the command line by using test agent controllers and test agents. Or you can run your automated tests that are associated with test cases from the command line. |
|
Scheduling automated tests to run as part of the build process: You can use a test category to select the automated tests in your build definition that you want to run if the build is successful. The test results are reported as part of the build status when a build finishes. If you have Visual Studio Lab Management, you can run automated tests that are associated with a test case and that are part of a test plan by using a lab environment to deploy the application and run the tests. |
Related Tasks
Running Load and Web Performance Tests
You can also run tests to isolate stress and load issues by using load and Web performance tests.
See Also
Concepts
Defining Your Testing Effort Using Test Plans