Creating a Physical Environment to Use for Testing

If you plan to run your automated tests using Microsoft Test Manager, you must use a physical or a virtual environment that contains a set of roles to run your tests from your test plan. To use a virtual environment, you must have installed. For more information about a virtual environment, see How to: Create an Environment from Virtual Machines or Templates.

You can create a physical environment using Microsoft Test Manager. A physical environment might use physical computers or virtual machines. To create a physical environment you must install one or many test controllers on available computers and associate each of them with Team Foundation Server. You can then install test agents on your computers and register them with the test controller. Each computer that is available to use in the environment is called a machine.

When you create an environment, you select a test controller to use for that environment and the set of roles to use for the application under test. A role specifies the purpose of a machine in the environment. For example, a specific role could be Web Server or Desktop Client. You can then select which machines to use for a role in an environment based on the properties of each role.

Use the following procedures to create a physical environment and manage the agents for that environment when you run tests.

  • Create a physical environment

  • Manage the test agents in your environment

Procedures

Create a Physical Environment

To create a physical environment

  1. Open Microsoft Test Manager.

    Note

    To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager 2010.

  2. Click the down-arrow on the center group switcher and then click Lab Center. Click Lab.

    The Environments view is displayed.

  3. Click the drop-down arrow next to New and then point to New physical environment.

    The New Physical Environment view is displayed with the Name and location page selected.

  4. Under Name, type the name for the environment.

  5. (Optional) Under Description, type a description for the environment so other team members know what it is intended for.

  6. Under Select the location, click the drop-down arrow to select the test controller to use to create the environment.

    Note   If there is no test controller available, you must install a test controller and register it with the team project. For more information, see Installing and Configuring Visual Studio Agents and Test and Build Controllers and Managing Test Controllers and Test Agents.

  7. (Optional) To mark your environment with a tag to help identify its use, click the double chevron to add a new tag. Click New tag to add the name and value for the tag.

  8. Click Next.

    The New Physical Environment view is displayed with the Machines page selected. From this page, you add the machines that you want in an environment and then you choose the role that this machine can be used for. A machine is a computer or virtual machine with the test agent software installed.

    Note

    If there are no available machines, you can select a different test controller to use for this environment or you can use the Team Test Agent Configuration Tool to add a test agent to the test controller that you selected. To run this tool from the test agent machine, Click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Visual Studio Test Agent 2010 Configuration Tool.

  9. To add a machine to an environment, select a machine in the Available machines list and then click Add to environment.

    The machine is now displayed in the list of machines for the environment.

  10. To select a role for this machine, click Select/Type role. Click the drop-down arrow to select a role from the existing roles, or type the role that you want to define.

  11. Repeat steps 9 and 10 to add all the machines that you want for your environment.

    Note

    If you want many machines to be available for a specific role, you can add multiple machines for the same role.

  12. Click Next.

    The New Physical Environment view is displayed with the Machine Properties page.

  13. (Optional) To add a machine tag to help identify a specific type of machine, click New tag to add the name and value for the tag.

  14. Click Next.

    The New Physical Environment view is displayed with the Summary page. This shows the test controller, roles and machines added to this environment.

  15. Click Finish.

    The environment is created and displayed in the environments list.

Managing Your Agents when You Run Your Tests with Environments

When you add roles for your application to your test settings, you will see environments that match this set of roles.

When you run your tests using this environment with your test settings, the test controller that is selected for the run determines the availability of the required agents. These are the following situations that can occur when the agent availability is determined:

  • There is no agent available for the role that must run the tests. Your tests cannot be run. You can perform one of the following actions and then rerun your tests:

    • You can wait for an agent to become available for this role to run the tests.

    • If there are any agents that are offline that can be used for this role, you can restart the agent so that it is available.

    • In the environment that you are using for the test run, you can add another agent to the role that runs the tests. You may have to install a new agent and add it to a test controller and then add this agent to the role that runs the tests.

  • There is no agent available for one or more roles that run diagnostic data adapters. For more information about diagnostic data adapters, see Setting Up Machines and Collecting Diagnostic Information Using Test Settings. Your tests can be run, but the diagnostic data adapter cannot be run. You can run your tests without the diagnostic data adapter, or you can perform one of the following actions and rerun your tests:

    • You can wait for an agent to become available for these roles.

    • If there are any agents that are offline that can be used for this role, you must change the state of the agent to online using the Environments manager. In addition, you might have to restart the agent if it has been disconnected from the controller.

    • Check that the environment that you are using for this test run is not busy from the Environments manager in the Lab Center. If it is busy, you must wait until it is available in the ready state.

    • In the environment that you are using for the test run, you can add another agent to the role. You may have to install a new agent and add it to a test controller and then add this agent to the role.

See Also

Concepts

Managing Test Controllers and Test Agents

Setting Up Test Machines to Run Tests or Collect Data