Quick Start Guide for Automating Build, Deployment, and Test

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This is a Quick Start guide for Lab Management. The guide helps you get up and running quickly by describing how to use virtual environments for automating daily build, deploy, and test cycles. The following procedures describe the key steps for this Quick Start guide:

  1. Check-in application source code along with a unit test

  2. Create a build definition

  3. Create automated test case, test suite, and test settings

  4. Create a workflow for build, deploy, and test

  5. Queue the workflow

Before you start these procedures, complete the Quick Start Guide for Virtual Environments. Make sure that an environment has been created with a clean snapshot as described in that guide.

Check-in application source code along with a unit test

To check-in source code and unit test

  1. Click Start, All Programs, Microsoft Visual Studio 2010, and then click Microsoft Visual Studio 2010.

  2. Create a new team project or use an existing team project that contains the source code for your application.

  3. On the View menu, click Team Explorer

  4. In Team Explorer, double-click open Source Control. Map the local path for source control if you have not already done this. Check in all the source code into source control if you have not already done so.

  5. If you do not have unit tests associated with this project, create a new basic unit test:

    1. On the Test menu, click New Test.

    2. In the pop-up dialog box, click Basic Unit Test.

    3. When you are prompted, type a name for your test project.

    4. Open and edit the source code for the unit test in Solution Explorer.

Create a build definition

To create a build definition

  1. In Team Explorer, right-click Builds, and then click New Build Definition.

  2. In the new build definition wizard for new build definition, enter the required information:

    1. On the General wizard page, type the name for the build definition.

    2. On the Build Defaults wizard page, select a drop location where the binaries generated from compilation can be stored. This folder should be a Windows share that has write permissions for the build agent, and read permissions for everyone.

    3. On the Process wizard page, expand (Required), click Projects to Build, and then click the solution file for your application.

    4. On the Process wizard page, expand Agent, click Agent Requirements, Name Filter, and then click the build agent that must be used for compilation.

      Do not use the build agents that are installed in the virtual environment for compilation. They are used for deployment.

  3. Save the build definition.

  4. To verify the build definition, in Team Explorer, right-click the build definition, and click Queue New Build. In the pop-up dialog box, click Queue.

Create automated test case, test suite, and test settings

To create automated test case, test suite, and test settings

  1. In Team Explorer, expand the node for your team project, then right-click Work Items under your team project, and point to New Work Item, and then click Test Case.

  2. On the New Test Case page, in New Test Case, type a title for the test case.

  3. Click the Associated Automation tab, click the ellipsis () button, click the unit test to associate, and then click OK.

  4. In Microsoft Test and Lab Manager, click Testing Center. Create a test plan and test suite if you have not created one. For more information, see How to: Create a Test Plan.

  5. Add the automated test case to the test suite.

  6. In Microsoft Test and Lab Manager, click Lab Center, Test Settings, and then click New to create a new test setting.

  7. In the new test settings wizard, follow these steps:

    1. On the General wizard page, type the name for the test setting.

    2. Select Automated for the type of tests.

    3. On the Roles wizard page, select the correct combination of roles that represents your environment. From the list of roles, select the role on which tests must be run.

    4. On the Data and Diagnostics wizard page, select the collectors that are appropriate for your environment.

  8. Save the test settings.

Create a workflow for build, deploy, and test

To create a workflow for build, deploy, and test

  1. In Team Explorer, right-click Builds and then click New Build Definition.

  2. In the new build definition wizard:

    1. On the General wizard page, type a name for the build definition.

    2. On the Build Defaults wizard page, type the location of the build drops.

      This is the location where the binaries generated from compilation are stored by the build agent.

    3. On the Process wizard page, click the LabDefaultTemplate from the list of build process files.

    4. To specify the settings for the workflow, select the Workflow Settings column, and click the ellipsis (...) button.

  3. In the Lab Workflow Parameters dialog box, follow these steps:

    1. On the Environment wizard page, select the virtual environment that you created. Also, specify the snapshot to which the environment should be reverted to before the build is deployed.

    2. On the Build wizard page, click the build definition that was created earlier for compiling the application.

    3. On the Deploy wizard page, select the option to Deploy, and enter the scripts that should be run on each virtual machine of the environment.

    4. On the Tests wizard page, associate the test suite and test settings that should be used as part of the workflow.

  4. Click Finish to close the Lab Workflow Parameters wizard. Save the build definition.

Queue the workflow

To queue the workflow

  1. In Team Explorer, right-click the workflow definition that you saved, and then click Queue new build.

  2. When prompted, click Queue.

    This initiates a build-deploy-test cycle. After the source code is compiled, the environment is reverted to the selected snapshot, the build is deployed onto the virtual machines of the environment by running the specified scripts, and finally, the automated tests are run.

  3. At the end of the execution, view the build report and log.

See Also

Other Resources

Quick Start Guide for Virtual Environments

Quick Start Guide for Testing on Virtual Environments