Updated 7/16/2012: Please note this an archived post and the Lab Management VHD has been retired and been removed from the Microsoft Downloads site. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Visual Studio Lab Management 2010 enables teams to accelerate setup/tear down and restoration of complex virtual environments to a known state for test execution and build automation. It extends build automation by automating virtual machine provisioning, build deployment and build verification in an integrated manner. It also allows testers to file rich bugs with links to environment snapshots that developers can use to recreate complex environments; effectively reducing wasted time and resources in your development and test lifecycle. A few months back, we had released a similar VHD with Visual Studio RC bits; but the new version has the following distinctions

  1. It uses the Visual Studio RTM build, so you get the latest version to try out various scenarios.
  2. There is an additional two-machine environment stored in the library. So you can try all the lab management scenarios in this multi-machine environment, which is closer representative of the customer’s deployment.
  3. This VHD also contains another environment with Network Isolation capability. So you can run multiple copies of environment in parallel without any machine name/IP address conflicts.
  4. Team Foundation Server has been configured with SharePoint and reporting services. So you can use this VHD to demo all the Application Lifecycle Management (ALM) capabilities offered by VS family of products

To enable quick evaluation of the Lab Management 2010 pre-RTM, we have created a Windows Server 2008 R2 Hyper-V based Virtual Machine (VM) that provides an all-in-one setup with pre-configured System Centre Virtual Machine Manager, Visual Studio, Team Foundation Server with Lab Management enabled. You can download this pre-configured VM from here.

This document consists of the following sections:

  • Setup instructions for importing this Virtual Machine (VM), configuring an internal virtual network and configuring this VM and the host machine (Estimated Time : 1 Hour)
  • Walkthroughs to try out following scenarios
    • Provision environments quickly (Estimated Time: 30 minutes): deploying a stored Virtual Environment on the host and taking a snapshot.
    • Automate the build-deploy-test cycle (Estimated Time: 30 minutes): executing an end to end workflow that covers building a sample web application, deploying it onto the virtual environment and executing Coded UI test
    • File rich bug with environment snapshots (Estimated Time: 30 minutes): filing rich bugs with automatic collections environment snapshot, which can be used by developer to debug the issue
  • Other advanced scenarios

Table of contents

Overview

In order to use the Lab Management features, a physical Hyper-V host is required. The Hyper-V host is used to run both the downloaded VM (LabServer) and the virtual environments.

Machine

Type

Details

Physical Hyper-V Host

Physical

Hyper-V Host for hosting Virtual Machines listed below

LabServer (the VM you downloaded)

Virtual

Machine name: labserver.labdomain.local

  • Domain Controller: labdomain.local, to which the physical host is joined
  • A virtual internal network to which the physical host, the LabServer VM and Virtual Environments are connected
  • DNS Server and DHCP Server (to provide IP addresses to machines connected to Internal Network)
  • Team Foundation Server 2010 that runs source control, work-item tracking, test case management, build and Lab Management
  • Visual Studio Ultimate 2010
  • Microsoft Test Manager 2010
  • System Centre Virtual Machine Manager (SCVMM) Server and Admin console

TailSpin VM Template

Virtual Template

A Windows Server 2008 R2 based Stored Virtual Machine template

TailSpin Environment

Virtual

Application and Database tier for TailSpin Application

Shown below is the diagram once the LabServer VM and the Hyper-V host are configured.

diagram

Setup Steps

Pre-requisites

Setup a clean install of Windows Server 2008 R2 on a Hyper-V capable machine with

  1. At least 8 GB RAM
  2. At least 60 GB free hard disk space
  3. Enable Hyper-V role on the machine
  4. Machine should be joined to a Workgroup (as later in the setup, you will join this host machine to a private AD)
  5. Use this machine only for testing/evaluation purposes

In case you are not able to complete the Setup and Scenarios section within 10 days, you must first activate this VM to continue using for 180 days (trial period). Refer to Activation section for more details.

 

Import the virtual machine

 

  1. Login to your host server using local Administrator credentials (All the steps below should be performed as administrator)
  2. Download all the package files to this host machine.
  3. The VM is available as a collection of self-extracting RAR files. Run the “Visual Studio Lab Management (pre-release) 2010 VHD.part01.exe”
  4. Accept the License terms and select a folder to extract the rar package (The extraction will take ~30 minutes, and consume ~36 GB of disk space)
  5. Click Start, point to Administrative Tools, and then click Hyper-V Manager.
  6. From Hyper-V Manager’s Action pane (right side pane), click Import Virtual Machine.
  7. Click Browse and select the folder LabServer (this would be under “Visual Studio Lab Management (pre-release) 2010 VHD” folder) in the Import Virtual Machine popup screen and choose the defaults.
  8. Click Import and then click close. (Ignore the warnings, if any)
  9. clip_image009Troubleshooting Tips
    1. If you are using Windows Server 2008 SP2 or import of the LabServer VM  fails for other reason, you should try creating a new Virtual Machine using Hyper-V Manager, with 4 GB of RAM, and use the existing VHD (browse to the folder LabServer\Virtual Hard Disks\LabServer\.vhd)

Configuring virtual network adapters

  1. Open Hyper-V Manager.
  2. From the Actions menu, click Virtual Network Manager (left side pane).
  3. Delete all Internal and Private Networks which are already present.
  4. Create an Internal network adapter (This will be used to connect the physical host, LabServer VM and Virtual Environments)
    1. Under New virtual network, select Internal and click Add.
    2. The New Virtual Network page appears, give it a name (LabNetwork) and click OK.
    3. You may get a warning that “Pending changes may disrupt network connectivity”, Click Yes, to Continue (you may lose network connectivity to the host for a couple of minutes)
  5. Create an External network Adapter (this will be used for activating the virtual machine)
    1. Again open the Virtual Network Manager from Hyper-V Manager.
    2. Under New virtual network, select External and click Add.
    3. The New Virtual Network page appears, give it a name (“External Network”) and click OK.
    4. You may get a warning that “Pending changes may disrupt network connectivity”, Click Yes, to Continue (you may lose network connectivity to the host for a couple of minutes)

Launch the Virtual Machine

  1. Once you go through the steps in Import the virtual machine to your Hyper-V manager, the virtual machine you added will be listed under the Virtual Machines pane.
  2. Right-Click on the virtual machine and click Settings.
  3. Select Network Adapter on the left side pane, choose LabNetwork (the internal network you created in the steps Configuring virtual networks) from the “Network” dropdown.
  4. Do NOT change the network of the second network adapter and keep it as “Not Connected”. This network adapter will be later used to activate the windows image of virtual machine. External not connected
  5. Double check that there are no other external facing adapters attached to your Virtual Machine. The VM has DHCP running and can interfere with your corporate network if it is not on an internal network.
  6. To preserve the VM state and to automatically start it when the Hyper-V Host is restarted, make sure that the LabServer VM is configured with the following settings:
    1. Right-Click on the LabServer VM and click Settings
    2. Select Automatic Start Action on the left side pane, and check “Automatic start if it was running when the service was stopped
    3. Select Automatic Stop Action on the left side pane, and check “Save the virtual machine state
    4. Click OK.
  7. Right-Click on the virtual machine and click Start.
  8. Do not change the computer name of the LabServer VM

Virtual Machine configuration

  1. Login to the LabServer VM using the following credentials
    1. Username: Labdomain\tfsadmin
    2. Password: P2ssw0rd (Capital P, Numeral 2, small s, small s, small w, numeral 0, small r, small d)
  2. Restart the VM if the machine asks for reboot to apply the system changes.
  3. Once the VM restarts and you login again, open Services(run services.msc) and make sure that the following services are running
    1. Visual Studio Team Foundation Background Job Agent
    2. Visual Studio Team Foundation Build Service Host
    3. Visual Studio Test Controller
  4. Open Control Panel -> Network and Internet -> Network and Sharing Center. Click on the “Local Area Connection x” (x could be any numeral say 4). local area connection
  5. Click on Properties and select “Internet Protocol Version 4 (TCP/IPv4)” and click on Properties again.
  6. In the General Tab, make sure that the network adapter has the following settingsIpv4 settings
    1. IP: 10.10.1.2
    2. Subnet: 255.0.0.0
    3. Default gateway: 10.10.1.1
    4. Preferred DNS: 10.10.1.2
    5. Click Advanced and select DNS tab:
      1. DNS 10.10.1.2
      2. DNS suffix for this connection: labdomain.local
      3. Select “Register this connection’s address in DNS” and “Use this connection’s DNS suffix in DNS registration”
      4. Click OK Static IP
    6. Click OK again.
      1. If you get the following message, answer Yes (This message comes up as the VM earlier had a network adapter to which same IP was assigned. But this adapter no longer exists, and hence it is OK to remove the static IP configuration for the obsolete adapter.) adapter warning
  7. Click Close and Close again.
  8. Restart the VM after performing the above steps. This will ensure that the DNS, DHCP and AD services can recognize the new adapter correctly.
  9. Once the VM restarts, login to the LabServer machine using the same credentials (labdomain\tfsadmin)

Hyper-V host configuration

  1. On Hyper-V host machine, open command prompt and run ipconfig to make sure that the host’s internal network gets a DHCP address assigned to it by the VM’s DHCP server
  2. Check the IP Address (should be 10.10.1.xxx) and that the DNS suffix should be: labdomain.local ipconfig
  3. clip_image009Troubleshooting tips
    1. On the host machine, use ipconfig /renew to get a new DHCP address on the host (if not already assigned)
    2. Make sure that LabServer VM and the Hyper-V host are able to communicate with each other
      1. Open command prompt from the host machine and run “ping labserver”
      2. Find the host name of the Hyper-V host (run hostname from command prompt). Open command prompt from the LabServer VM and run “ping <HostName>”
    3. Firewall might prevent the two machines from communicating to each other, turn off the firewall on the host and the LabServer VM.
    4. To disable all firewalls on this Hyper-V host. firewall
      1. Open Control Panel –> Check Firewall Status –> (from left side pane) Turn Windows Firewall on or off; alternatively run firewall.cpl
      2. Select “Turn off Windows Firewall (not recommended)” for each Network location settings (Domain, Home, Public etc.)
      3. Click OK
  4. Join the host machine to the domain of the VM (labdomain.local)
    1. On the Host machine, Click Start –> Computer –> Properties -> Change Settings
    2. Under the Computer Name tab, click Change
    3. Type the domain name: labdomain.local and click OK. In the popup, provide the following credentials.
      1. Username: Labdomain\tfsadmin
      2. Password: P2ssw0rd domain join
  5. Click OK and restart the Hyper-V host to apply the changes. (It is ok to restart the Hyper-V host even when the LabServer VM is running, as you had earlier configured to automatically save/start)
  6. clip_image009Troubleshooting tips
    1. If the domain is not found, verify that LabServer VM and the Hyper-V host are able to communicate with each other
      1. Open command prompt from the host machine and run “ping labserver”
      2. Find the host name of the Hyper-V host (run hostname from command prompt). Open command prompt from the LabServer VM and run “ping <HostName>”
    2. Firewall might prevent the two machines from communicating to each other, turn off the firewall on the host and the VM.
    3. If you have changed the machine name of the host, restart it; before connecting to the domain.
  7. Verification
    1. After the restart of Hyper-V host, login and ensure that the LabServer VM is also running. If not, go into Hyper-V Manager and start the VM.
    2. Connect to the LabServer VM and login using labdomain\tfsadmin. Open DNS Manager (Start -> Administrative Tools -> DNS) and verify that the host was successfully registered in the DNS. Notice that a new entry for your physical host is shown. (HyperVHost in the following image) dns manager
    3. clip_image009Troubleshooting tips
      1. If the host computer entry still does not show up, from an elevated command prompt on the host, run ipconfig /registerdns. Wait a few minutes and check the event viewer to see if there are errors. If not, check again in the DNS Manager to see that the host is registered.
  8. Add labdomain\tfsadmin as an administrator on the host machine. This is needed so that TFS and SCVMM can communicate with the host.
    1. Open Server Manager –> Configuration -> Local Users and Groups –> Groups -> Administrators (alternatively run lusrmgr.msc from the command prompt)
    2. Add labdomain\tfsadmin into the administrators group. Provide the following credentials in the popup
      1. Username: Labdomain\tfsadmin
      2. Password: P2ssw0rd

Lab Management configuration

  1. Make sure that all firewalls are disabled on this Hyper-V hostfirewall
    1. Open Control Panel –> Check Firewall Status –> (from left side pane) Turn Windows Firewall on or off; alternatively run firewall.cpl
    2. Select “Turn off Windows Firewall (not recommended)” for each Network location settings (Domain, Home, Public etc.)
    3. Click OK
  2. Add the host to the SCVMM host group.
    1. Login to the LabServer VM and open System Center Virtual Machine Manager (SCVMM) Admin Console.
      1. If VMM Server is not reachable, verify that the service Virtual Machine Manager is running on the VM.
    2. Click “Add host” from the right side pane. add host1
    3. Complete the Add Host wizard, by providing the following details:
      1. Select Host Location
        1. Username: tfsadmin
        2. Password: P2ssw0rd
        3. Domain: Labdomain add host2
      2. Select Host Servers
        1. Type the Computer Name as the machine name of your Hyper-V Host, and click Add.
        2. Ignore the warnings (on the bottom of wizard) and press Next
        3. If you receive a popup that Hyper-V role with be enabled, click Yes to continue
      3. Configuration Settings
        1. Host Group: “All Hosts”
        2. Check the “Reassociate host with this Virtual Manager Server” in case the host was earlier connected to another VMM Server add host3
      4. Host Properties
        1. Create a folder on your Hyper-V host on a drive which has at least 20 GB of disk space.
        2. Type the full path of the folder you created and click Add. add host4
      5. Review the summary and Click “Add Hosts”
    4. After the job is completed, you can check the host status by clicking the “Hosts” from the left side pane in SCVMM Admin console.
    5. clip_image009Troubleshooting tips
      1. Make sure that you are not running SCVMM Server on the Hyper-V host.
      2. Manually install the System Center Virtual Machine Manager Agent on the Hyper-V host and try adding the host again.
  3. Verifying that Lab Management is properly configured for the Project Collection
    1. Launch Team Foundation Server Administration Console (Start -> All Programs -> Team Foundation Administration Console)
    2. Select Team Project Collections (from the left side pane) -> Default Collection -> Lab Management tab -> Configure Library Shares
    3. Click Verify to check if VMM Library Share is configured appropriately. A green tick mark should appear. Verify library Share
    4. Select Host Groups tab, and click Verify to make sure that VMM Host Group (and the corresponding host) is configured appropriately. A similar green tick mark should appear.
    5. clip_image009Troubleshooting tips
      1. Add labdomain\tfsadmin as an administrator on the host machine

This completes the Lab setup and configuration. The subsequent sections help you to exercise various Lab Management scenarios.

Scenarios

Once you have configured the LabServer VM and the host as above, you can perform the following scenarios. These exercises are designed to enable a quick introduction to deploying a Virtual Environment, running an build-deploy-test workflow and creating a rich bug with environment snapshot.

For these scenario walkthroughs, we are using a sample web application called TailSpin, which is an online storefront for buying Airplanes. The company has decided to adopt virtualization to consolidate its hardware footprint and increase its utilization. The company decides to adopt Visual Studio 2010 Lab Management as it offers an out of the box integrated solution to leverage all the benefits of virtualization for application lifecycle management (ALM). Using Lab Management, the company is able to accelerate their software release cycle and also improve the overall quality as

  1. Developer and testers are able to quickly provision virtual environments
  2. Build automation is extended to environment provisioning, application deployment and testing
  3. Testers are able to file rich bugs which include link to environment snapshot

Following artifacts have already been created to carry out the scenario walkthroughs

  1. TailSpin sample web application checked-in to the source control
  2. Coded UI Test cases for the application checked-in to the source control
  3. Testing artifacts – test plan, manual and automated test cases, and test settings
  4. Build definition for compiling the TailSpin application
  5. An build-deploy-test workflow
  6. A Virtual Machine Template (Windows Server 2008 R2) stored into the library. This VM templates has the following software installed
    1. Build agent
    2. Lab agent
    3. Test agent
    4. SQL Server Express 2008
    5. IIS role
  7. A stored Virtual Environment created with the above VM Template

Scenario 1: Provision environments quickly

(Estimated Time: 30 minutes)

In this exercise, the Test Lead uses Microsoft Test Manager to deploy a virtual environment that will be later used for nightly build verification.

  1. Login into LabServer VM (labdomain\tfsadmin, P2ssw0rd)
  2. Start Microsoft Test Manager. It will automatically connect to the TailSpin. Otherwise connect to LabServer\DefaultCollection -> TailSpin
  3. Go to Lab Center, if you are currently under Testing Center
  4. Click Deploy under the Environments section. lab center
  5. It will show Stored Environment from the Library. Select TailSpin Environment and Click Deploy.
  6. Do not change the name of Environment as the same name has been used in end-to-end workflow definition.  Deploy Environment
  7. The environment deployment will typically take ~20 minutes.
  8. Once the environment is deployed, right click on the environment name and Click Start. Similarly right click on the environment name and Click Connect
  9. This will open the Microsoft Environment Viewer to enable interaction with the virtual machines in the environment.
  10. Login environment’s Virtual Machine using the following credentials (click Ctrl+Alt+Del from the toolbar in the Environment Viewer):
    1. Username: Labdomain\tfsadmin
    2. Password: P2ssw0rd
  11. clip_image009Troubleshooting tips: If you are not able to connect to the environment using environment viewer
    1. Click on the System Info in the environment viewer and note the SCVMM VM Name
    2. From the Hyper-V Manager on your Hyper-V Host, connect to this VM.
    3. Login using the Administrator (local admin) and enable remote desktop on this Virtual Machine.
    4. Now from the Microsoft Test Manager, right click on the VM in the right side pane, and click Remote Desktop
    5. Provide the labdomain\tfsadmin credentials and accept any certificates
  12. Troubleshooting tips: If you are not able to login using the labdomain\tfsadmin
    1. Try to login using the local Administrator (password: P2ssw0rd)
    2. From the computer properties, check if the VM is part of a Workgroup or joined to the Domain (labdomain)
    3. If it is a workgroup VM: Click on the System Info in the environment viewer and note the SCVMM VM Name
    4. From the Hyper-V Manager on your Hyper-V Host, select this VM, right click and open Settings.
    5. Make sure that in the Ethernet Port on the left side pane, LabNetwork (Internal network you created earlier) is selected. Otherwise manually select the LabNetwork and click OK.
    6. Also delete all other Internal and Private networks (except LabNetwork) from the Virtual Network Manager.
    7. Using Microsoft Environment Viewer, manually join the VM to the labdomain domain (use labdomain\tfsadmin, P2ssw0rd)
    8. Restart this VM and verify if you are now able to login using labdomain\tfsadmin.
  13. Once you login, the Test Agent processes should start-up and connect to the Test controller. Make sure that the status changes to Online.  Test Agent Status
  14. You might see that one of the capabilities (Testing or Workflow) has some errors. Click on the “Repair Testing capability” so that testing capability is configured appropriately.  Repair testing
  15. After a few minutes, the Testing capability should also be in Ready State.
  16. Disable Internet Explorer popups. This is to make sure that IE popups do not interfere with the Coded UI Tests (which will be executed later)
    1. Launch Internet Explorer from the Virtual Machine in the environment.
    2. In the “Set up Windows Internet Explorer 8” popup, click Next. Do NOT choose “Ask me later”, as this will later interfere with the execution of automated tests.
    3. Select “Yes, turn on Suggested sites” and Click Next
    4. Select “Use express settings” and click Finish.
    5. Now Close the Internet Explorer.
  17. Once, the testing and workflow capabilities are ready, Select the Snapshots tab from the left side pane in the Microsoft environment viewer
  18. Click on the “Take Snapshot” icon and give it a name “Clean State”. Take Snapshot
  19. Use the same name (TailSpin Environment) as it as it has been used in end-to-end workflow definition 

Scenario 2: Automate the build-deploy-test cycle

(Estimated Time: 30 minutes)

Visual Studio 2010 enables you to automate your whole build-deploy-test cycle using Lab Management, build and testing tools. This helps you to address some of the following key pain points with build-deploy-test cycles

  1. Today the whole process is not automated and results in manual effort and issues. You preferably want to automate the whole process so that in the morning when the team comes to work, the build is generated, application is deployed on the environment and initial testing is already completed.
  2. Confidence on daily builds deployed on the same environment is not high as changes may be left from an earlier build. You preferably want to setup the daily build on a clean environment.
  3. Agility for debugging issues with other builds which are not currently deployed is really bad as we need to reset the environment and then deploy the build needed for debugging. You preferably want to have a one click experience to go to any build for debugging.

As part of this walkthrough you will experience how Visual Studio 2010 helps you to overcome the above challenges by running an end to end Workflow that builds the application, deploys the application on the Clean state of virtual environment and runs Coded UI Tests.

  1. From the LabServer VM, open Visual Studio and go into Team Explorer. It should automatically connect to “LabServer\DefaultCollection -> TailSpin”.
  2. Go to Builds -> Right Click on “BuildDeployTest-TailSpin” -> Edit build definition. This should open the build definition for editing.
  3. Go to Process, from the left side pane and click on icon besides Lab process settingsBuildDeployTest1  
  4. A new wizard for changing Lab workflow parameters should open up.
  5. Go to Environments, from the left side pane
    1. From the dropdown, select the TailSpin Environment we created earlier.
    2. Check the option to “Revert to a specific snapshot of the environment” and select Clean StateBuildDeployTest2  
  6. Click Finish and Save the build definition “BuildDeployTest-TailSpin”
  7. Right click on the build definition “BuildDeployTest-TailSpin”, click on Queue new build.
  8. Use the Default Options and Click Queue. (The workflow will take ~10 minutes to complete)
  9. To see the progress of this workflow, double click on the “BuildDeployTest-TailSpin” in the Build Explorer. BuildDeployTest3
  10. The workflow performs the following activities
    1. Compile/Build the TailSpin application and associated Coded UI tests
    2. Revert the TailSpin Environment to the clean snapshot that you created earlier
    3. Deploy the build on this environment
    4. After the build has been deployed, take a post deployment snapshot.
    5. Run Coded UI Tests (CUIT) 
  11. You can go to Microsoft Environment Viewer to see when Environment is either reverted to a snapshot, or Post Deployment Snapshot is taken.
  12. Once the workflow is in the Running Tests step, you can even see the Coded UI Tests are being run in the Virtual environment. From the environment Viewer, check if TailSpin home page opens up automatically, and some pages are being navigated by the Coded UI Tests.
  13. Once the workflow completes, it should report success if the deployment and test execution completes.  BuildDeployTest4
  14. clip_image009Troubleshooting tips
    1. If some of the tests failed, Internet Explorer popups could have disrupted the Coded UI tests.
      1. Using environment Viewer, Revert the environment to the snapshot “Clean State”
      2. Perform the steps mentioned in the section “Scenario1: Provision environments quickly” on how to disable Internet explorer popups.
      3. Take another snapshot of the environment and give it an appropriate name (say “New Clean State”)
      4. Again perform the steps as mentioned in this scenario, and in step 5.2 choose the snapshot you just created.
    2. If you see the message “The service is unavailable” in the browser, you can safely ignore this message. Hit the back button in the internet explorer and check if TailSpin application is working fine.
    3. In the build report, you might see the message/error something like “Unable to add user or group labdomain\Windows-abcd123$”. You can ignore this message.
    4. Using environment Viewer, you can now do further testing of the TailSpin application.

    Scenario 3: File rich bugs with environment snapshots

    (Estimated Time: 30 minutes)

    Visual Studio 2010 enables testers to file rich bugs that help developer to debug the issue without wasting time in bug ping pong between developer/tester (e.g. developer claiming that a bug does not reproduce on his/her machine and wants more details e.g. system info, event logs etc.)

    As part of this walkthrough you will experience how Visual Studio 2010 enables filing of rich bugs with automatic collections with each bug. Also with a bug you can create a Snapshot of the whole environment which can be used by developer to debug the issue. With Snapshot developer gets the whole environment in exactly the same state where the bug was filed.

    1. Open Microsoft Test Manager, switch to Testing Center and select Plan tab.
    2. Select TailSpin Test Plan and click Properties from the top.
    3. Under the Run Settings section,
      1. Under Manual runs, select
        1. Test Settings: TailSpin – Manual
        2. Test environment: TailSpin Environment
      2. Under Automated runs, select
        1. Test Settings: TailSpin – Automated
        2. Test environment: TailSpin Environment  Test Plan
    4. Click on Save and Close.
    5. Now select the Test tab.
    6. Select Manual Test Suite, under the TailSpin Test Plan
    7. Select the test case “Validate if discount coupon is applied”, and right click and select Run
    8. This will open Microsoft Test Runner.
    9. Select the option “Overwrite existing action recording” and Click Start Test.
    10. Follow the steps specified in the Test case, and for each step you can assign the result as Pass or Fail (Step 8 should Fail).
    11. For step 1 of the test case, Click on "Connect to environment" (from the above toolbar) which will open Environment Viewer. mtr3   
    12. Click on "System Info" and copy Computer Name. Now Close the System Info dialog. Machine Name
    13. For Step4, open http://<ComputerName>/tailspin.web/default.aspx in Internet Explorer. Replace <ComputerName> with the actual machine name (without FQDN), you got from the System Info dialog e.g. open http://windows-abcd1234/tailspin.web/default.aspx
    14. The Step 8 will fail as after adding the discount coupon, web page throws an error. Mark this step as Fail, and add an appropriate Comment.
    15. Click on the Capture rectangular screenshot and take a screen clipping where the web page shows an error. This will automatically attach a screenshot to the test step. 
    16. As this bug may be difficult to debug for your developer, so you should take a Snapshot of your environment by clicking Take Environment Snapshot in the Microsoft Test Runner toolbar. This will automatically attach a snapshot of the environment to the test step. MTR1
    17. Now file a bug by clicking Create a bug.
    18. In the New Bug window, provide the Title (No Discount is applied) for the bug and Assign it to TFSAdmin.
    19. You can check the Details, System Info tabs to see all the rich information which has been collected automatically.
    20. Click Save and Close to create the bug.
    21. Click Resume and follow step 10.
    22. Click On Save and Close in the Microsoft Test Runner. You can choose to overwrite existing action recording, if you are asked for a confirmation.

    As a tester you have a created a rich bug. Now let’s see how developer can easily reach the state of the environment where the bug was filed.

    1. Open Visual Studio and connect to LabServer\DefaultCollection -> TailSpin in the Team Explorer.
    2. Expand the Work Items -> Team Queries and double click on My Bugs
    3. In the query results, you will see the bug which you just created.
    4. Review the detailed information in Details, System Info, Test Cases tabs, to understand under what conditions the bug was found.
    5. You can also see which of the test steps passed/failed.
    6. Under the Details tab, double click on the .lvr file.  mtr2
    7. In the Connect to Environment dialog, select the option Connect to snapshot in this environment and click Connect. This will revert the environment to the exact state where the bug was filed.
    8. Once the environment viewer opens up, you (as a developer) can easily investigate into the bug and fix it accordingly.

    Activation

    The evaluation period for this virtual machine image is 180 days; once the evaluation period terminates, the image should be discarded. NO EFFORT SHOULD BE MADE TO ACTIVATE THIS IMAGE after that date. Please read the following to get an idea of the risks and key things you need to know.

    Guidelines on usage:

    1. You have 10 days to activate the product. If not activated within 10 days, the system will shut down once every hour until activated.
    2. The 180-day Trial is the full working version of the Windows Server 2008 R2 x64 Enterprise Full installation, the version most of you will be working with in your corporate environment. It will not require a product key (it is embedded with the download).
    3. The 180-day Trial will shut down once every hour when you have reached the end of the 180-day evaluation period.

    For complete use-rights, please refer to the EULA contained within this evaluation package.

    1. Do not redistribute this image.
    2. Do not put this image into a production environment.
    3. It is recommended not to join this image to a corporate network.
    4. Since this Virtual Machine is running a DHCP Server, you should not connect directly to an external network. Follow the steps in the next section on how to activate this image

    Activation steps

    1. Login to the LabServer VM using the labdomain\tfsadmin and close all other active programs.
    2. Open Services(run services.msc), right click on DHCP Server and click Properties
    3. Change the Startup type to Disabled. Click OK.  dhcp service
    4. Open Hyper-V Manager on your Hyper-V Host; right click on the LabServer VM and click Settings
    5. Change the Network of second adapter to “External Network” from the dropdown (the external network you created in the steps “Configuring virtual networks”). Click OK. external adapter
    6. clip_image009Troubleshooting tips
      1. Open Virtual Network Manager from the Hyper-V Manager to find which of these adapters is connected to the external network
    7. From inside the LabServer VM, open Internet Explorer, Click on Tools –> Internet Options and select Connections tab.
    8. Click on LAN settings, Select Automatically detect settings. Click OK and OK again.
    9. Open the Computer Properties (Start Menu -> Computer -> Properties) and click on the Activate Windows now
    10. Under the section Windows activation, Click on the option Activate Windows online now
    11. clip_image009Troubleshooting tips
      1. If you hit the Error Code 0xC004B011, the system clock may not be showing the correct time.  system clock error
      2. Manually update the system time and date of the your Hyper-V host and LabServer VM (according to your time zone) and try Windows activation again.
      3. If you are not able to connect to internet, also provide the Proxy Server’s address in Internet Explorer (Tools -> Properties -> Connections tab -> LAN settings -> Select “Use a proxy server for your LAN…”)
    12. Once the Windows activation succeeds, Click Close.
    13. Open Hyper-V Manager on your Hyper-V Host; right click on the LabServer VM and click Settings
    14. Change the Network of second Network Adapter to again “Not Connected”. Click OK.   external adapter 2
    15. Login to LabServer VM and open Services(run services.msc), right click on DHCP Server and click Properties
    16. Change the Startup type to Automatic. Click OK.
    17. Again right click on DHCP Server and click Start.

    You can follow the same approach for activating the VM’s which are part of virtual environment (disabling DHCP is not required). Connect to the environment and Click System Info in the environment viewer. Note down the “SCVMM VM Name” and shutdown the environment. Using Hyper-V Manager, temporarily add an external network adapter for this virtual machine. Follow the steps similar to 7-12 mentioned in the above section to activate the image, and later remove the external adapter.

    Advanced Scenarios (optional)

    Scenario 4: Build-Deploy-Test workflow on a multi-machine environment

    (Estimated Time: 60 minutes)

    A typical application requires multiple machines to test it. E.g. a Web application has a Web Server, a Database server and a web client. Since more than one machine is likely to be used in the production, testing in similar distributed environment is very important. Using Lab Management, you can create complex environments to test multi-tier application and assign a Role (Web Server, Database Server etc.) to each machine in the environment.

    In this scenario, we will be deploying on a two machine environment for testing the TailSpin application. One of the machine will act as a Web Client and the second machine hosts both the Database Server (SQL) and the Web Server (IIS).

    1. Open Microsoft Test Manager and Go to Lab Center, if you are currently under Testing Center
    2. Click Deploy under the Environments section.
    3. It will show Stored Environment from the Library. Select “TailSpin multi-machine Environment” and Click Deploy.
    4. Do not change the name of Environment as the same name has been associated in end-to-end workflow definition.
    5. The environment deployment will typically take ~35 minutes.
    6. clip_image009Troubleshooting tips
      1. If the deployment fails because of insufficient disk space, free-up some disk space on the hyper-v host machine. Also make sure that the drive which has sufficient space has been added as placement path in Virtual Machine Manager.
      2. If the deployment fails because of insufficient memory, you should shut down the environment you previously created in the Scenario1, and re-try the deployment.
    7. Once the environment is deployed, right click on the environment name and Click Start. Similarly right click on the environment name and Click Connect
    8. This will open the Microsoft Environment Viewer to enable interaction with the virtual machines in the environment.
    9. Login to each Virtual Machine in the environment using the following credentials (click Ctrl+Alt+Del from the toolbar in the Environment Viewer):
      1. Username: Labdomain\tfsadmin
      2. Password: P2ssw0rd
    10. Once you login, the Test Agent processes should start-up and connect to the Test controller. Make sure that the status changes to Online in each machine of environment.
    11. You might see that one of the capabilities (Testing or Workflow) has some errors. Click on the “Repair Testing capability” so that testing capability is configured appropriately.
    12. After a few minutes, the Testing capability should also be in Ready State.
    13. Disable Internet Explorer popups. This is to make sure that IE popups do not interfere with the Coded UI Tests (which will be executed later).
      1. Launch Internet Explorer from the Web Client machine in the environment.
      2. In the “Set up Windows Internet Explorer 8” popup, click Next. Do NOT choose “Ask me later”, as this will later interfere with the execution of automated tests.
      3. Select “Yes, turn on Suggested sites” and Click Next
      4. Select “Use express settings” and click Finish.
      5. Now Close the Internet Explorer.
    14. Once, the testing and workflow capabilities are ready, Select the Snapshots tab from the left side pane in the Microsoft environment viewer
    15. Click on the “Take Snapshot” icon and give it a name “Clean State”. Use the same name as it as it has been used in end-to-end workflow definition
    16. Open Visual Studio and go to Team Explorer. Go to Builds -> Right Click on “BuildDeployTest-2Tier-TailSpin” -> Edit build definition. This should open the build definition for editing.
    17. Go to Process, from the left side pane and click on icon besides Lab process settings
    18. A new wizard for changing Lab workflow parameters should open up.
    19. Go to Environments, from the left side pane
      1. From the dropdown, select the “TailSpin multi-machine Environment” you created earlier.
      2. Check the option to “Revert to a specific snapshot of the environment” and select Clean State
    20. Click Finish and Save the build definition “BuildDeployTest-2Tier-TailSpin”
    21. Right click on the build definition “BuildDeployTest-2Tier-TailSpin”, click on Queue new build.
    22. Use the Default Options and Click Queue. (The workflow will take ~10 minutes to complete)
    23. To see the progress of this workflow, double click on the “BuildDeployTest-2Tier-TailSpin” in the Build Explorer.
    24. The workflow performs the following activities
      1. Compile/Build the TailSpin application and associated Coded UI tests
      2. Revert the TailSpin Environment to the clean snapshot that you created earlier
      3. Deploy the build on the multiple machines of this environment
      4. After the build has been deployed, take a post deployment snapshot.
      5. Run Coded UI Tests (CUIT) 
    25. You can go to Microsoft Environment Viewer to see when Environment is either reverted to a snapshot, or Post Deployment Snapshot is taken.
    26. Once the workflow is in the Running Tests step, you can even see the Coded UI Tests are being run in the Virtual environment. From the environment Viewer, check if TailSpin home page opens up automatically, and some pages are being navigated by the Coded UI Tests.
    27. Once the workflow completes, it should report success if the deployment and test execution completes.

    Scenario 5: Network Isolation

    (Estimated Time: 90 minutes)

    Network Isolation enables you to run multiple copies of the environment in parallel without machine name or IP conflicts. The machines in a network-isolated environment are protected from network conflicts by using two network adapters. One network adapter is used for a private network inside the environment. The second adapter is configured by Lab Management to present a separate, unique identity to the external network.

    In this scenario, we will first deploy a Network Isolated TailSpin Environment (the VM inside the environment will be a workgroup machine). Next we run a build-deploy-test workflow to deploy the TailSpin application. Then we store a copy of this environment in the library, and later create a new environment using this stored copy. Hence we will be able to run two environments with TailSpin application, where the machines have the same machine name etc.

    1. Open Microsoft Test Manager and Go to Lab Center, if you are currently under Testing Center
    2. Click Deploy under the Environments section.
    3. It will show Stored Environment from the Library. Select “TailSpin Isolated Environment” and Click Deploy.
    4. Do not change the name of Environment as the same name has been used in end-to-end workflow definition.
    5. The environment deployment will typically take ~20 minutes.
    6. Once the environment is deployed, right click on the environment name and Click Start. Similarly right click on the environment name and Click Connect
    7. This will open the Microsoft Environment Viewer to enable interaction with the virtual machines in the environment.
    8. Login environment’s Virtual Machine using the following credentials (click Ctrl+Alt+Del from the toolbar in the Environment Viewer):
      1. Username: Administrator
      2. Password: P2ssw0rd
    9. Note you need to login as local administrator as the machine of this isolated environment is a workgroup machine.
    10. Click Start, Microsoft Visual Studio 2010, Test Agent configuration Tool
    11. Enter the username as .\administrator and Password as P2ssw0rd
    12. Click on Apply Settings. It will ask the password of tfsadmin, provide P2ssw0rd
    13. After few minutes, the Test Agent processes should start-up and connect to the Test controller. Make sure that the status changes to Online.
    14. You might see that one of the capabilities (Testing or Workflow) has some errors. Click on the “Repair Testing capability” so that testing capability is configured appropriately.
    15. After a few minutes, the Testing capability should also be in Ready State.
    16. Disable Internet Explorer popups. This is to make sure that IE popups do not interfere with the Coded UI Tests (which will be executed later)
      1. Launch Internet Explorer from the Virtual Machine in the environment.
      2. In the “Set up Windows Internet Explorer 8” popup, click Next. Do NOT choose “Ask me later”, as this will later interfere with the execution of automated tests.
      3. Select “Yes, turn on Suggested sites” and Click Next
      4. Select “Use express settings” and click Finish.
      5. Now Close the Internet Explorer.
    17. Once, the testing and workflow capabilities are ready, Select the Snapshots tab from the left side pane in the Microsoft environment viewer
    18. Click on the “Take Snapshot” icon and give it a name “Clean State”.  Use the same name as it as it has been used in workflow definition
    19. Open Visual Studio and go into Team Explorer. Go to Builds -> Right Click on “BuildDeployTest-TailSpin” -> Edit build definition. This should open the build definition for editing.
    20. Go to Process, from the left side pane and click on icon besides Lab process settings
    21. A new wizard for changing Lab workflow parameters should open up.
    22. Go to Environments, from the left side pane
      1. From the dropdown, select the “TailSpin Isolated Environment”
        you created earlier.
      2. Check the option to “Revert to a specific snapshot of the environment” and select Clean State
    23. Click Finish and Save the build definition “BuildDeployTest-TailSpin”
    24. Right click on the build definition “BuildDeployTest-TailSpin”, click on Queue new build.
    25. Use the Default Options and Click Queue. (The workflow will take ~10 minutes to complete)
    26. To see the progress of this workflow, double click on the “BuildDeployTest-TailSpin” in the Build Explorer.
    27. The workflow performs the following activities
      1. Compile/Build the TailSpin application and associated Coded UI tests
      2. Revert the TailSpin Environment to the clean snapshot that you created earlier
      3. Deploy the build on the multiple machines of this environment
      4. After the build has been deployed, take a post deployment snapshot.
      5. Run Coded UI Tests (CUIT) 
    28. You can go to Microsoft Environment Viewer to see when Environment is either reverted to a snapshot, or Post Deployment Snapshot is taken.
    29. Once the workflow is in the Running Tests step, you can even see the Coded UI Tests are being run in the Virtual environment. From the environment Viewer, check if TailSpin home page opens up automatically, and some pages are being navigated by the Coded UI Tests.
    30. Once the workflow completes, it should report success if the deployment and test execution completes.
    31. clip_image009Troubleshooting tips
      1. You might see the following message in the build report. You can ignore this message, since this machine is joined to workgroup; hence the account domain\Windows-abcd123 doesn’t exist.
        1. There is no such user or group: labdomain\Windows-abce123
        2. More help is available by typing NET HELPMSG 3783
    32. Using environment viewer, shutdown the environment
    33. In Microsoft Test Manager, right click on the Isolated Environment, and Click Store to Library
    34. Enter the name as “TailSpin Isolated Environment Copy” and click Store. This step would take ~20 minutes
    35. Once the Copy of the environment is stored, Click on Deploy again.
    36. Select the “TailSpin Isolated Environment Copy” and Click Deploy This step will take ~20 minutes.
    37. Once this environment is also deployed, right click on the environment name and Click Start. Similarly right click on the environment name (TailSpin Isolated Environment Copy) and Click Connect
    38. This will open the Microsoft Environment Viewer to enable interaction with the virtual machines in the environment.
    39. Login environment’s Virtual Machine using the following credentials (click Ctrl+Alt+Del from the toolbar in the Environment Viewer):
      1. Username: Administrator
      2. Password: P2ssw0rd
    40. Note you need to login as local administrator as the machine of this isolated environment is a workgroup machine
    41. Using environment viewer, you can now open TailSpin home page in internet explorer: http://localhost/tailspin.web/default.aspx
    42. Similarly you can open TailSpin home page on the earlier TailSpin Isolated environment.
    43. You can also check the same computer name of these environment (copy and original) by clicking on the System Info.

    Appendix

    The following table lists the details of all the artifacts in the VM

    VM Machine Name

    labserver.labdomain.local

    Domain Name

    labdomain.local

    Domain Administrator

    labdomain\tfsadmin, P2ssw0rd

    TFS Administrator

    labdomain\tfsadmin, P2ssw0rd

    SCVMM Administrator

    labdomain\tfsadmin, P2ssw0rd

    Service account for test/build agent-controller communication

    labdomain\tfsadmin, P2ssw0rd

    Default SCVMM Library Share

    MSSCVMMLibrary, “C:\ProgramData\Virtual Machine Manager Library Files”

    Default Host Group

    All Hosts

    Template with agents installed

    TailSpin VM Template

    Stored environment in library

    TailSpin Environment

    TailSpin Source code

    C:\Map

    Sample Test Plan

    TailSpin Test Plan