Setting up agents/controllers for lab

In order to deploy your build and run your tests on a virtual environment, you need to enable the workflow and testing capabilities of the environment. To successfully configure these capabilities, you need to understand a few concepts and how different pieces integrate, viz. test agent, test controller, build agent, build controller, lab agent. The purpose of this post is to:

  • Explain these concepts and show you how they fit together
  • Explain the why, what, and how – for both these capabilities

The big picture

Let us start with the final view of an environment, configured to run tests and workflows. You can find the status of the different capabilities (and errors if any) from the Environments tab in Lab Center of Microsoft Test Manager. The following screen shot shows an environment ready to run tests and deployment workflows. You can enable these capabilities when you create the environment.

image

In order to get these capabilities ready, you need to do some (one-time) steps and setup/ configure the right pieces. Here is a picture that explains how the capabilities work and the different blocks involved.

image

Here is another view of what agents are needed on the virtual machines for each environment capability.

Environment Capability

Lab Agent Required?

Test Agent Required?

Build Agent Required?

Testing

X

Deployment workflow

X

Network Isolation

X

X

 

Individual blocks

Now, let us deep-dive into the answers for why the capability is needed, what all pieces need to be configured, and how to configure them. Refer to the diagram above to understand how the components interact with one another.

0. Pre-requisites

- We highly recommend you to set up a service account for lab management. By doing this, you don’t have to take care of permissions for the agents/controllers individually. Find out more about service account here. The setup guide explains how to setup lab service account here.

Note: The rest of this article assumes you have set up the lab service account.

1. Testing capability

Why?

In order to run manual or automated tests on an environment, you need to enable the testing capability. For manual tests, the testing capability lets you collect rich logs (ex: Intellitrace, event logs) from the various roles/machines that are part of the virtual environment. You can also take snapshot of the environment from the test runner and attach a link to it with the bug. You can run automated tests on environments where testing capability is enabled and ready.

What?

- To get the testing capability working, you need to install/configure the lab agent and test agent on each of the virtual machine(s) that are part of the environment. If you have VM templates stored in your library, install these agents on the templates.

- You also need one (or more) test controller(s) setup and registered with the team project collection you are connected to. The test controller is outside the virtual environment. To understand where to setup the test controller, you can review the ‘Choose a deployment topology’ section here.

How?

- Lab agent, test agent and test controller are part of the Visual Studio Agents 2010 package. You can download and install Visual Studio Agents here. You can find documentation on how to configure the agents here.

- We recommend you use VM prep tool to automatically install the lab agent and test agent on the machines in the environment or on the templates from which the VMs are created. Review the usage and download VM prep tool from here.

- Once you have your environment set up with testing capability, review the documentation to learn how to run manual tests and automated tests on the environment.

2. Workflow capability

Why?

In order to deploy your build and run automated tests on your virtual environment, you need to enable the workflow capability. In other words, you can run a build-deploy-test workflow on an environment where the workflow capability is ready.

What?

- We use the build agent/build controller framework to run the deployment workflows on the environments. While it is the same build agent/controller used to create your daily builds, it is important to note that the same components have been re-used to deploy your builds on the environment.

- To get the workflow capability working, you need to install/configure the lab agent and build agent on each of the virtual machine(s) that are part of the environment. If you have VM templates stored in your library, install these agents on the templates.

Note: The build agent should be configured to run either as “NT Authority\System” (LocalSystem) or under an account with local administrator privileges. This is needed to run deployment workflows.

- You also need one (or more) build controller(s) setup and registered with the team project collection you are connected to. The build controller is outside the virtual environment. To understand where to setup the build controller, you can review the ‘Choose a deployment topology’ section here.

How?

- Build controller and build agent are part of Team Foundation Server installer available here. Lab agent is part of Visual Studio Agents package available here. You can find documentation on how to configure the agents here.

- We recommend you use VM prep tool to automatically install the lab agent and build agent on the machines in the environment or on the templates from which the VMs are created. Review the usage and download VM prep tool from here.

- Once you have your environment set up with workflow capability, review the documentation to learn how to deploy your build on the environment and run automated tests after deployment.

Summary

By setting up the agent/controllers as described above, you should quickly be able to get the environments ready to run tests and deployment workflows. If you face any trouble with these capabilities, you can check out the troubleshooting guide here. If you have any comments or feedback, please let us know.