Using Notwork isolation in Lab Management and solve some issues



In this post I will describe how we can use the network isolation capability of the Lab Management in MTM (Microsoft Test Manager), I will also show how to solve some issues I faced, this video is part of my whole guide of “TFS 2010 Enterprise installation and configuration guide” that published on CodePlex, so for more information about the whole installation and configuration, see the guide on CodePlex

The first issue I faced was

TF260073 incompatible architecture error when trying to deploy an environment in Lab Manager

This error can happen for many reasons, it happened for me because the LabAD (Active Directory) machine was not be able to deployed to the host (Hyper V) machine that I assign for the TFS Lab Management, and this was because LabAD (Active Directory) was created on the server at my work and the processor was not supported in my home environment, when I try to change the property of the machine to support different process architecture while it stored on the library, it couldn’t save the changes, so I just copy the VHD file from the library to the desired host and then create a VM based on that VHD and then store the created VM on the library again from this host that will deploy to it later, so my advice if this problem happened that you try to use SCVMM to deploy the machine on the desired host and to solve the problem first and then return to the Lab Management

The second issue I faced was

TF267055: The machine is not ready to run tests because of the following error: Unable to connect to the controller on ‘<TestControllerFQDN>:6901′. Reason: No such host is known. Make sure the test controller is online and the firewall on the test controller is not blocking the connection

This happened because the Test Agent can’t resolve the Test controller machine name, I try many solution, like adding the Test controller machine IP with name in the host file, but no matter what the IP resolved it’s different, we know that any machine that working in isolation network is will has 2 virtual network adapters one for private network and one for external network and everyone has it’s own DNS, so the  solution was just add the Test Controller record in the private Domain LabAD (Active Directory) in my case and everything working great.

For any help, just contact me :-)

For more information about Network isolation on MSDN you can visit the following link


http://msdn.microsoft.com/en-us/library/ee830480.aspx#NetworkIsolatedEnvironments

Creates test cases from test methods using tcm.exe



Tcm.exe is an application that can be used to creates test cases from test methods, we can also run test cases with associated automation test  instead of using the user interface so it can be run with the nightly build batch

When you start the run from the command line, use tcm.exe. You must specify both the test settings that contain the set of roles that you require to run your tests, and an environment that contains this set of roles.

So

Tcm.exe is a command-line utility that lets you perform the following tasks:

Workflow integration and Testing capabilities of lab management



What is the workflow integration and testing capabilities?  This is what Build Agent, Lab Agent and Test Agent will provide

The workflow integration:

It refer to the capabilities of the Lab Management to deploy existing build on the build server or trigger build on the build server and deploy it (so Build Agent on virtual environment only deploy the build on the build server not really build it)

The testing capabilities:

It refer to the capabilities of the Lab Management to run tests on that environment

Updated in 2 Aug 2011

Here a good post on the Lab Management team blog on this feature

Setting up agents/controllers for lab

Lab Environment Viewer (LEViewer.EXE)



LEViewer is an application that enable developer or anyone else to open environment snapshot, so the Tester can take a snapshot of the environment and attached it to the bug and the developer can open the bug, see the attachment and open the snapshot using LEViewer

LEViewer

LEViewer

Complete the virtual machine after you create your environment in Lab Management



After I create the enviroment

  • Join any machine to the domain
  • Add TFSLAB as local admin for all machine that has build agent (becaue Builg Agent configuration) (I will not use TFSBUILD since the build agent just need to deploy not to compile so we don’t need account access the source control)
  • Configure the Test Agent  ( using TFSLAB) for each machine depend on the machine (Client—> interactive process, Server–> service)
  • Configure the build Agent ( using TFSLAB)
  • Refresh your environment
  • it should work now

How to create template on the SCVMM to be used with creating virtual environment on Lab Management?


Updated on April 17, 2012

You can see the full video series (93 videos) of install and configure TFS 2010 in enterprise, see the guide on the Codeplex


http://tfs10enterprise.codeplex.com/

End of April 17, 2012 update 

 

 

First of all you can create the template with auto tool which existing at the following links:


http://archive.msdn.microsoft.com/vslabmgmt


http://vslabmgmt.codeplex.com/

But I prefer to describe the manual process so we can imagine what happen there, so what are the steps?

  • Install OS and SP  and any needed components
  •  Install the Test Agent ( and don’t configure)
  • Install the Lab Agent  ( no configuration needed)
  • Install the build Agent (and don’t configure)
  •  Because I didn’t use DHCP in my domain so I make a static IP for the DNS on virtual machine, this IP point to my domain so when I create a new environment I can join the domain automatically while creating the environment
  • I also Enable Win 2008 R2 feature which is (.NET Framework 3.5) because Build Agent will need it.
  • I fix the date and time because Egypt now changed :-) the summar time, no longer change

After I create the environment I make the following, just for reminding

  • Configure Test Agent for client machine as interactive process with TFSLAB account
  • Add TFSBUILD account to the Administrators local group account for any virtual machine that will has build
  • Configure Build Agent using TFSBUILD account (no needed any more, see this post click here)

Important update for Lab Management 2010



There is important update for Lab Management 2010, that fix many problems

Download : 
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=868

This update contains fixes and updates to the Lab Management functionality to improve performance, stability, usability and diagnostic information. The following is a list of major fixes in this update:

  • Improves performance for Lab Management Workflow Wizard.
  • Improves performance for running automated test cases on Network Isolated Lab environments.
  • Fixes an issue in which a Test Controller service account that is the same as a Lab Service account causes issues with environment capabilities.

Note: You need to install this update on all of your client machines running Microsoft Test Manager, Test Controller, Team Foundation Server, build and virtual machines. This update is required to use the final release version of the Visual Studio 2010 Lab Management functionality. Please make sure that required software components from the release version of Visual Studio 2010 are installed before you install this update.

There is also a good link for troubleshooting Lab Management

Troubleshooting errors in lab management

 

Lab Center and Test Center summary story


Updated on April 17, 2012

You can see the full video series (93 videos) of install and configure TFS 2010 in enterprise, see the guide on the Codeplex


http://tfs10enterprise.codeplex.com/

End of April 17, 2012 update 

 

 

I create 4 videos on YouTube that will describe the lab center and test center from the beginning to the end, this videos not focus of describing lab and test centers in details it will show the scope of them so you can know what you can do with them.

You can download the presentation by click here




Install and configure Lab Center 2010


Updated on April 17, 2012

You can see the full video series (93 videos) of install and configure TFS 2010 in enterprise, see the guide on the Codeplex


http://tfs10enterprise.codeplex.com/

End of update April 17, 2012 update 

Prepare your environment as the following:

  • Lab Management with TFS architecture

Lab Management and TFS architecture

Lab Management and TFS architecture

  • Install TFS, Build Server and Test Controller

TFS without Lab Management

TFS without Lab Management

  • Install Hyper-V on a physical machine
  • Install SCVMM on the Hyper-V machine or any other machine
  • Install Admin console on the SCVMM  machine to configure the library and add the host machine(s) (Hyper-V) to the SCVMM
  • Install Admin console on the TFS machine
  • Configure Lab Management on the TFS machine from The TFS Administration console

TFS with Lab Management

TFS with Lab Management

  • Create virtual machines on the Hyper-V and prepare them as you need of OS or application (one Windows 2008 R2, one Windows 7, one Windows Vista, etc..)
  • Join all created virtual machines to the domain
  • Install Lab Agent, Test Agent, Build Agent on every virtual machine (as needed) for example if you will not run automated test on the virtual machine you will not need test agent
  • Run those machines on the Hyper-V so you can create the template from them ( you don’t need it)
  • Create templates using the existing configured virtual machine that running on the Hyper-V or if you didn’t run them in the Hyper-V, you can create them from virtual hard disk VHD and then put those templates on the library
  • Import the templates in the Lab Management from the library
  • Create any number of environments using imported virtual machines (templates)
  • Deploy the created environment to Hyper-V (it happen automatically as you create your environment)
  • You can store the environment on the library or not
  • Start using your environment in your manual or automated test

Notes

  • I decide to install the build controller on the TFS and create a separate machine as a build server which has the build agent, I will create also a separate machine as a test controller because the recommended is to not install test controller on the TFS machine and the recommended also not install the build agent on the TFS machine
  • Hyper-V will be the host for all virtual machines in my infrastructure included TFS, Build Server, Test Control mahcines, it will include also the library of the templates or actual virtual machines or environment or the running environment, remember the library can has template machines or virtual environment in another word you can create the template from virtual machine and store it in the library and you can also create virtual environment and store it in the library on the SCVMM
  • When you install the build agent on the virtual machine at the last step choose option 3 (Manual configure or use with Lab Management) and when you click configure from the Lab Center, it will configure it automatically
  • After you create the virtual machine that you will use to create your templates, if there is any error happen setup the build agent try to add the account needed in the administrators group of the virtual machine itself
  • When I configure Lab Management from TFS Admin Console at the project collection configuration, at service account settings, I choose TFSLAB which is a domain account with restricted permission, this account will be used when I configure the Test Agent on the virtual machine that has the Test Agent, and also will be used by the Lab Management to configure the Build Agent
  • After you install Test Agent you configure it to run as service or interactive process (Coded UI test)
  • You install the Test Agent if you want to run automated test on the machine and you may configure as (Service if this a server machine web server for example or configure as  Interactive process if it’s client machine windows 7 for example) so if you log in in interactive case you must log-in using TFSLAB or the account that used in configure Test agent and Lab Management configuration on TFS Admin console
  • Test Agent configured manually on the virtual machine–> start–> Test Agent configuration
  • Build Agent configured automatically by the Lab Management on the virtual machine–> when connecting to the machine using Lab center click configure button
  • When I configure Test Agent, with TFSLABaccount I have an error ”Test agent is not configured to run interactively under this account. Run the Test Agent Configuration Tool to change the interactive user account.”  This error could happen from many reason my reason was that I write the domain when configure the Test Agent like (mydomain.com\TFSLAB) but it should be (Mydomain\TFSLAB), there are another resoan if you comfigue the Test Agent using local account, for more info see the following linkTroubleshooting errors in lab management
Configure Test Agent

Configure Test Agent

Configure Test Agent part 2


Lab Management overview


Updated on April 17, 2012

You can see the full video series (93 videos) of install and configure TFS 2010 in enterprise, see the guide on the Codeplex


http://tfs10enterprise.codeplex.com/

End of April 17, 2012 update 

 

 

What is Lab Management ?

Lab Management is a new Tool in ALM 2010 that provide you with the ability to:

  • Manage Physical or virtual environments for your test team or QA:

Because as a  tester you have a group of physical or virtual machines that you will use them to run your test, so how you will manage this machines? Remote desktop or physical management….? it will be very hard, but with Lab Management the life is easier

  • You can prepare a complex test environment in a few minutes with everything configured:

You can create complex virtual environment in a few minutes, for example you can create  5 machines 3 of them has Window 2008 R2 and the one has Windows 7 Ultimate and the other has Windows Vista, you create all this machines  from templates or virtual machines that stored in the library on the SCVMM (System Center Virtual Machine Manager) in just a few minutes

  • Run manual or automated test on this environments and collect valuable info when bug happen:

When you run an automated test or even a manual test you need to collect important data like capture the screen error, record the error video or even collect the Event log info and many other important info from the machine that host the bug.

  • Collecting valuable info:

You will not collecting just screen capture or video capture or even event log only, you can capture the whole environment (snapshot with Hyper-V) and it will attached automatically to the test result so the developer can open this snapshot and work on the machine that host the bug (No more it’s working on my machine)

  • There are many other things we will talk throughout the series