Sdílet prostřednictvím


Using a Virtual Lab for Your Application Lifecycle

Visual Studio Lab Management is an extension of Microsoft Test Manager that helps you to optimize the use of Microsoft Hyper-V technology to manage and use virtual machines in testing, building, and developing applications in Visual Studio 2010. Visual Studio Lab Management is integrated with System Center Virtual Machine Manager (SCVMM) to enable you manage multiple physical computers that host virtual machines and to manage the storage of virtual machines, virtual machine templates, and other configuration files in SCVMM library servers.

Virtual environments are groups of virtual machines that are managed by Lab Management. Virtual environments enable you to:

  • Reproduce the exact conditions of a bug or other development issue.

    Lab Management snapshots capture the state of all computers in the environment at a point in time. A snapshot of environment can be shared with members of a project team. A reference to the stored snapshot can be included in Visual Studio Team Foundation Server work item so that a copy of the environment can be created with a few clicks of the mouse. When Microsoft IntelliTrace data is included in the work item, the execution path of the application to the bug can be fully reproduced on the exact configuration where the bug occurred.

  • Build, deploy, and test applications automatically in a clean environment.

    Using Lab Management workflows for Visual Studio Team Foundation Server builds, environments, snapshots and Microsoft Test Manager automated tests, you can stage daily builds of your application to a clean environment. After tests have been run, you can store the environment in a snapshot and then restore the environment to its original state so that it can be used again.

  • Reduce the time required to create and configure machines for testing an application.

    Using Lab Management stored virtual machines and templates, you can quickly deploy customized environments that recreate the configuration of customer's production environments.

  • Run multiple copies of a test or development at the same time

    Using Lab Management stored virtual environments, you can deploy multiple copies of a virtual environment at the same time without the computer name conflicts that can limit the use of unmanaged virtual machines in a domain.

  • Enable members of a team to create and manage virtual environments without requiring system administrator privileges.

    You can use Lab Management permissions to create role-based self- service groups of team members who can deploy, create and manage virtual environments without requiring system administrator privileges. You can also combine Lab Management permissions with Visual Studio Team Foundation Server and SCVMM permissions to meet the specific requirements of your organization.

You create an environment by using Microsoft Test Manager and assign virtual machines to each role that is required for the application that you intend to develop, test, or run. For example, you might be developing a multi-tiered application that requires three roles: a desktop client, a Web server, and a database server. By using Lab Management, you can create a virtual environment that assigns a virtual machine to each role, deploys each part of the application to the relevant virtual machine by using Team Foundation Build, and then runs the three virtual machines as a single instance of the application for testing. The following illustration shows a virtual environment that uses the three roles: desktop client, Web server, and database server.

Environment for Multi-Tier Application

If your application is complex, you can assign multiple virtual machines to the same role in a virtual environment. Similarly, you might be developing an application that requires the same two roles to be deployed in two different topologies. For example, the data tier and the application tier might be located on the same machine in one topology, whereas the two tiers are located on separate machines in the other topology. The first topology is represented in one virtual environment, and the second topology is represented in a separate virtual environment. Your virtual lab now contains the two environments that you have to have for testing.

You can also have a virtual environment where only some components of the application are deployed whereas other components are shared across environments. For example, if your application needs a large database, you can decide to host a shared database on a physical machine. All virtual environments will have only virtual machines for the client and application tiers that can connect to the shared database as required.

Poznámka

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.

Key Concepts

You must understand some key concepts before you start to use Lab Management:

Virtual machines (Hyper-V)

Key Concept

Description

Virtual machine

A virtual machine is a software implementation of a computer that runs programs as if it is a physical computer. This enables you to run multiple virtual machines on one physical computer. You must install your virtual machine with an operating system and any other software that you require.

Host

The physical computer that runs the virtual machine.

Snapshot

A snapshot saves the state of your virtual machine at a specific point in time. You can revert your virtual machine to this snapshot whenever you want and then use this virtual machine from this known state when the snapshot was taken.

Service Center Virtual Machine Manager (SCVMM)

Key Concept

Description

Template

A template is a generalized image of a virtual machine that has been stripped of identifying information such as the machine name and the product key. You can create multiple virtual machines from a template without creating computer name conflicts on a domain.

Host group

A group of physical computers that are hosts that can be used to run virtual machines. Host groups optimize the deployment of virtual machines on the collection of hosts for you, so that you do not have to select to which host each virtual machine is deployed. You can assign host groups to your team projects and team project collections in Team Foundation Server.

Library server

A computer that is used to store virtual machines, templates, and other resources.

Library share

A shared location on a library server where you can store your virtual machines, templates, and other resources. You can have multiple library shares. You can assign library shares to your team projects and team project collections in Team Foundation Server.

Lab Management

Key Concept

Description

Virtual environment

A collection of virtual machines that run on Hyper-V hosts, are managed by System Center Virtual Machine Manager, and which Lab Management manages as a logical unit. Each virtual machine that you add to the environment is used for a role in your application. For example, you might select a role of Web server for a virtual machine.

Physical environment

A collection of physical machines, each of which has a test agent installed. If you have virtual machines running on a non-Hyper-V platform, you can model them as physical machines in Lab Management.

Lab Center

The activity area in Microsoft Test Manager where you manage and operate the virtual machines and environments that are deployed on the SCVMM host groups of your team project.

Team project library

The activity area in Test Manager where you manage the stored virtual machines, templates, and stored environments that are located in the SCVMM library shares of your team project.

You can use either physical or virtual machines in creating and managing environments, testing, or build deployment.

Creating and managing environments

Creating virtual machines from a template, cloning environments using network isolation, VM operations such as Start/Stop/Snapshot/Pause are exclusively available for Hyper-V based virtual environments and not available for non-Hyper-V or physical environments.

Testing

Using Microsoft Test Manager, you can run tests on both virtual as well as physical environments. The capabilities are exactly the same here and this means that you can run automated and manual tests, and do rich diagnostic data collection from all sorts of environments – Hyper-V, non Hyper-V, and physical.

Build deployment

You can easily automate the build-deployment-testing workflow on Hyper-V virtual environments using the template shipped in TFS 2010 (labdefaulttemplate.xaml).

For physical environments, such a template is not available out of the box. However, since this automation is based on Windows Workflow Foundation 4.0, you can customize the template (or create your own) using the activities in the toolbox, to automate build deployment and testing on physical machines. This means you can do the same for non-Hyper-V environments as well, however note that the virtual environment specific actions (restore to snapshot/start/stop environment) will not be available for physical and non-Hyper-V environments.

Lab Management works with both virtual environments hosted on Hyper-V and physical environments, but the capabilities of each type of environment are different. Virtual environments on non-Hyper-V hosts are treated the same as physical environments. The following table summarizes the different capabilities for each type of environment.

Capability

Virtual Environments (Hyper-V)

Physical Environments

Virtual Environments (non-Hyper-V)

Testing

Run unit tests

Supported

Supported

Supported

Run manual tests

Supported

Supported

Supported

Run coded UI and other automated tests

Supported

Supported

Supported

File rich bugs using diagnostic adapters

Supported

Customization required

Customization required

Build deployment

Automatic build-deploy-test workflow

Supported

Environments creation and management

Create environment from VM template

Supported

n/a

Not supported

Start/stop/snapshot environment

Supported

Not supported

Not supported

Connect using Environment Viewer

Supported

Not supported

Not supported

Clone environment using network isolation

Supported

n/a

Not supported

For the latest information about support for environments that use virtual machines running on non-Hyper-V hosts, such as VMWare, see this Microsoft Webpage.

Next Steps

Task

Related content

Try it out: Discover the resources to initially configure Team Foundation Server, SCVMM, and Lab Management, and then create and run virtual machines in an environments

Getting Started with Lab Management

Create virtual environments for your lab: Lab Management provides a number of ways to create and use virtual environments. Learn how to create the virtual environments that best fit your needs.

Virtual Environments Concepts and Guidelines

Creating Virtual Environments

Integrate Lab Management in your testing lifecycle: Learn how to use virtual environments to make testing more efficient, and the reproduction of bugs easier to create and share.

Testing Using Virtual Environments

Capture the complete state of a virtual environment: Lab Management snapshots Let you store the exact state of an environment at a point in time. Testers and developers can then roll back the environment to that state. You can use snapshots to create a clean environment for testing or to reproduce a bug or development issue.

Using Snapshots to Store, Reproduce, and Share the State of Virtual Environments

Build, deploy, and test your application automatically:   Combine Lab Management virtual environments with Team Build workflows and Test Manager test plans to automate the deployment and testing of regularly scheduled build of an application under development.

Deploying An Application to a Virtual Environment

Customize the default workflow template: Add more activities to the lab default workflow template to meet the additional requirements in your build-deploy-test scenario.

Customizing Lab Management Workflow

Find more information and assistance on MSDN blogs and forums:  Lab Management blogs and forums provide troubleshooting information and answers to specific questions about using virtual environments.

Troubleshooting Lab Management

See Also

Concepts

Configuring and Administering Lab Management

Configuring Lab Management for the First Time

Debugging with IntelliTrace

Testing the Application