Using Microsoft Test Manager (MTM) with multiple Environments

Posted by: Gouri Sohoni , on 12/23/2016, in Category Visual Studio
Views: 25216
Abstract: This article discusses multiple ways to create an environment using Microsoft Test Manager

I was preparing for training to be conducted based on Visual Studio Team Services (VSTS) with a focus on Test Hub. The training also required various features from Microsoft Test Manager 2015. The client had provided different requirements where I needed to try how to create various environments. To fulfil customer’s need made me think of different ways with which we can create environments. While doing all this preparation I encountered a lot of hurdles and though about how I overcame those.

 

Microsoft introduced Microsoft Test Manager (MTM) (separate IDE for testers and test leads) in 2010. Since then there are a lot of enhancements with Microsoft Test Manager (MTM). Microsoft also introduced testing facility with Team Web Access along with Visual Studio 2013. Recently Microsoft introduced Exploratory Testing (XT) with Visual Studio Team Services Preview (on Chrome browser). Every sprint comes with new features (VSTS sprint is three weeks). You can follow this link to read more about XT.

When you are testing any application, you can use any of the tools available as discussed earlier. It can be Microsoft Test Manager or Team Web Access with on-premises Team Foundation Server, or it can be Microsoft Test Manager or Test Hub in conjunction with Visual Studio Team Services.

The testers are required to provide as much information about the bug as possible. Microsoft introduced Lab Management for this purpose way back in 2010. Over the years, there have been a lot of enhancements to this feature, and now we do not have to limit ourselves to only Virtual Machines.

Microsoft mentions that there is no need to have Test Controller for TFS and Visual Studio 2015, but sadly this is not so. We can still use Test Controller 2013 Update 5 with TFS and Visual Studio 2015.

Let us find out how to create different environments and test our application.

MTM - First Scenario

Let us see the simple way of creating a standard environment in which you are having MTM on the client and connected to on-premises Team Foundation Server. The standard environments can be used to deploy builds but cannot be used to take a snapshot. Following are the pre-requisites

1. The machine should have Microsoft Test Manager installed (as MTM always works in connected environment, connection to TFS is by default)

2. The machine should be able to connect to a computer on which the Test Controller is installed and configured (as there is no separate installer for Test Controller 2015 Microsoft suggests to use Test Controller 2013 Update 5 even though we are using MTM 2015 and TFS 2015). The configured Test Controller looks as below

configured-test-controller

Once you meet the pre-requisites, you can open MTM, connect to the TFS to perform test planning and management. Select Lab Centre tab and select Lab artifact

- Click New for creating a new environment and select “Standard Environment.”

cr-standard-env-first-scr

Provide proper name and description for the environment.

- Select Machines tab to provide details about the machine to be added. In current case we are using the same machine as the standard environment. We can provide the role for the machine being added in terms of “Desktop client”, “Database Server” or any of the roles shown below

stan-env-cr-machine-role

We also need to provide the credentials to be used for this machine.

- With Machine Properties tab we can provide information which can be used during build workflow as per the tag given to the machine,

- “Advanced” tab allows to run UI tests for the machine(s) added in the previous step. We have to provide credentials for this.

- “Summary” tab provides the summary of selections we made in the previous tab as the name suggests.

- Finally “Verification” tab checks that the test controller is available, the machines can be accessed using the credentials given, the environment name is unique within the Team Project, and the said machines are not part of any other environment

- Once the verification is successful, the environment gets created. The Test Agents are automatically configured on the machines when we are using Microsoft Test Manager 2015. If we are going to run UI Tests the Test Agent needs to be set up as an interactive process.

The complete environment will look as follows:

stan-env-completed

MTM - Second Scenario

Let us turn to another scenario. Let us assume we have an Azure Virtual Machine, which has TFS 2015. This azure machine also has a Test Controller (Visual Studio 2013 Update 3) installed, and I want to create a standard environment from a client machine for testing. This client machine has MTM 2015 installed on it.

Connect to the Azure TFS from MTM 2015. Most of the steps in the previous scenario remain the same except now we are using TFS from Azure machine.

During this scenario, I have observed that we get the following warning a lot of times (even though the background agent job is running)

env-warning

It takes a lot of time for this to work. I have not found any proper guidance material on this topic. But I can assure that if finally works.

Following screenshot shows the Test Controller is configured and is in Ready State on my Azure machine

mtm-test-controller

 

MTM - Third Scenario

In the previous scenarios, we have considered only one machine as a part of the environment. We can add as many machines as we want, depending upon the type of application under test. We can have one machine working as IIS Server, another as a database server, and the third as a client. In my example, I have selected these three roles and added three machines to the environment. All these machines are in the same domain. These machines can be physical machines or virtual machines. The snapshot functionality will be available only when we use SCVMM (System Centre Virtual Machine Management) facility to create an environment. This feature is not available in a standard environment. You can observe from following diagram that the required updates and test agent configuration on the machines in the environment, are automatically taken care of. Just ensure that all the machines which you are trying to add to the environment, are having internet access.

auto-test-agent-configuration

In the following diagram, we can see that all the machines in the environment are in a ready state and the environment is also ready.

3-machines-env

MTM - Fourth Scenario

The last scenario I am going to discuss is about creating an environment amongst Azure machines. This is with the assumption that you already have an account in Azure. If not, head over to the Azure Subscription page for a free trial.

There are a couple of pre-requisites for creating an environment with Azure machines.

1. Create an azure virtual network. The machine which needs to have the Domain Controller (DC) and DNS on it must be a part of this virtual network. To start, create a virtual network and then add a virtual machine to it.

vm-to-virtual-network

2. Before we create a domain controller and DNS on a machine, we need to provide a static IP address. To create a static IP address for an Azure machine, we have to install and configure Azure PowerShell. Install Azure PowerShell from this link.

a. After installation, we can start Windows PowerShell ISE

b. Provide the following cmdlet and enter proper credentials

Add-AzureAccount
Select-AzureRmSubscription –SubscriptionName <subscription name> 
Get-AzureVM -ServiceName <service name> –Name <virtual machine name>   
| Set-AzureStaticVNetIP -IPAddress 10.0.0.4 | Update-AzureVM

c. Confirm that the IP address is given to the Virtual Machine (10.0.0.4 in my case)

Now is the time to install DC and DNS on the Azure machine. For Windows Server 2012, you can do it by adding a role for Active Directory Domain Services. Add the required features.

ad-role

Add the DNS Server role:

ad-and-dns

You need to add a new forest in Active Directory Domain Services Configuration Wizard. Follow the wizard steps and finally you will get an Install option after verification. The install option is only available once all the pre-requisites are satisfied. This is quite a time consuming process.

3. The next step is to add other Azure virtual machines to this domain. These virtual machines should be part of the virtual network created earlier. As already mentioned, we need to provide this virtual network at the time of creation of a virtual machine. Once the virtual machine(s) is created, we can add it to the domain and later install the required software on it.

4. Now what remains is to create a standard environment where the application can be tested.

Conclusion

In this article, I have discussed multiple ways to create an environment using Microsoft Test Manager. I have discussed how to create standard environment which can either be using physical machines or virtual machines as per the need. In order to use machines from the environment to take snapshots, we need to use System Centre Virtual Machine Management (SCVMM). While the machines get added to the environment, the Test Agent gets automatically configured on them. The Test Agent is used to capture any diagnostic data adapter we provide with MTM.

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Author
Gouri is a Trainer and Consultant on Azure DevOps and Azure Development. She has an experience of three decades in software training and consulting. She is a graduate from Pune University and PGDCA from Pune University. Gouri is a Microsoft Most Valuable Professional (MVP)  - Developer Technologies (Azure DevOps), Microsoft Certified Trainer (MCT) and a Microsoft Certified Azure DevOps Engineer Expert. She has conducted over 150 corporate trainings on various Microsoft technologies. She is a speaker with Pune User Group and has conducted sessions on Azure DevOps, SQL Server Business Intelligence and Mobile Application Development. Gouri has written more than 75 articles on Azure DevOps, TFS, SQL Server Business Intelligence and SQL Azure which are published on www.sqlservercurry.com and www.dotnetcurry.com. You can connect with her on LinkedIn.


Page copy protected against web site content infringement 	by Copyscape




Feedback - Leave us some adulation, criticism and everything in between!