Testing Using Virtual Environments

Using Visual Studio Lab Management you can run manual or automated tests from a test plan using your virtual environments. This lets you run your tests on an environment that uses a known state for all the virtual machines in the environment. Now, testers no longer need to create clean machines in a known state manually, which can make it much quicker to set up an environment to use for testing. You can also deploy your application to your virtual environment that uses Lab Management. For more information about how to deploy your application, see How to: Deploy an Application on a Virtual Environment.

Note

If you will be performing manual or automated testing in purely physical environments, or in physical environments composed of third-party virtual machines, you do not need to do any of the following tasks: use Hyper-V, configure SCVMM, or configure lab management. Instead, you can simply install a test agent on the physical machine, register a test controller with your team project collection, and configure the test agent to use that test controller. After you have done this, use the Lab Center in Microsoft Test Manager to create a new physical environment. For the steps to create a physical environment and run tests, see Creating a Physical Environment to Use for Testing.

When you run one or more of these tests from your test plan, you can save your test results into the team project for your Team Foundation Server. You can now view the progress of both your automated and manual tests together from your test plan.

To run manual tests using a virtual environment, you must use Microsoft Test Manager to add the virtual environment and test settings for manual tests to your test plan and then run your tests from a test plan as shown in the following illustration. Then you can view your test results from your test plan.

Run Manual Tests

Note

You can also select Run with options from the Run Tests view to select the virtual environment and test settings to use when you run your tests.

If you find a bug in your application when you run your manual tests, you can take a snapshot of your virtual environment that a developer can use to connect to the actual state of your machines in your environment when you found the bug. This helps create easily reproducible bugs.

If you want to run automated tests using your virtual environments, you must associate your automated tests with test cases using Microsoft Visual Studio 2010, create test settings and add your virtual environment for your automated tests to your test plan, and then run them using Microsoft Test Manager.

If you want to schedule your tests to run as part of your build process using Visual Studio Lab Management you can create a workflow using a build definition for Team Foundation Build that enables you to build your application, deploy it to your virtual environment and then run automated tests.

Tasks

Use the following topics to help you run your tests using virtual environments:

Tasks

Associated Topics

Run scheduled tests on a virtual environment after each build of your application: You can create a build definition using Team Foundation Build with the lab template that enables you to create a workflow to build and deploy your application and then run automated tests from your test plan and view the results. You must set up your virtual environment to enable the workflow capability to use this functionality.

Running manual tests and creating reproducible bugs using virtual environments: You can run manual tests from your test plan using Test Runner to record if each step passes or fails. The test outcome and any data that is collected from your virtual environment when you run the test can be saved. This includes taking a snapshot of your virtual environment. You can submit a bug that includes a link to this snapshot that a developer can use to easily re-create the environment at the time that the bug occurred.

Speeding up manual testing: You can record the UI actions that you take when you run a manual test. When you run the test again, you can play back the action recording that you created to automatically perform these actions.

Running automated tests using virtual environments: You must first associate your automated tests with test cases. Then you can run automated tests from Microsoft Test Manager using your virtual environment. You can also run your automated tests from the command line with tcm.exe using your virtual environment.

Analyzing test results: You can analyze the test results for your automated tests for each test run. You can then submit bugs for any issues that you find.

Customizing how your tests are run: You can create your own diagnostic data adapters to collect specific data or affect the test machine when you run your tests.

See Also

Concepts

Using a Virtual Lab for Your Application Lifecycle

Running Tests

Setting Up Test Machines to Run Tests or Collect Data