Thursday, February 13, 2014

MTM (Microsoft Test Manager) – Test Configuration for handling multiple test environments

Author: Ranjit Gupta & Raj Kamal
While creating test plan one thing you need to keep in mind the configuration against which your test cases needs to be run. Configuration can be anything like browser, OS, .net version, different version of your product or may be different environment i.e. test, staging etc.

So after your test execution you would like to have test result against each configuration.

Test configuration manager in MTM allows you to have as many test point of your test case depending upon the number of configuration you have.

Test point is paring of test case and configuration. If you have two test case TC1 and TC2 and configuration as C1, C2 and C3 then you will have totally six test point. Test point relate to the number of test case and configuration you create.

You can create your own configuration from the organize tab as shown below and assign the configuration to your test cases


Specifying Default test plan-

You can create a default configuration as shown below, so now every test cases which gets added to the test plan the default configuration gets applied to it. It gets applied even to the test cases which are copied from other test plan.


Making use of configuration to run automated test

You can make use of MTM configuration to run your automated test on different browser. Consider you want to run your test on chrome, firefox and IE. Create three configuration under your automation test plan named as “chrome” , “firefox” and “IE” and assigned them to your automated test cases.

When test is triggered from MTM TestContext exposes many information out of which “__Tfs_TestConfigurationName__property can be utilized to determine on which browser the test should run.


In your Coded UI test  test initialize method read the name of your configuration assigned to test cases as below

if (TestContext.Properties["__Tfs_TestConfigurationName__"].ToString() != null)


                BrowserWindow.CurrentBrowser = TestContext.Properties["__Tfs_TestConfigurationName__"].ToString();



So now your coded ui test runs on the browser you have specified in your MTM configuration.

1 comment:

Tcea said...

Really useful for running automated test cases using different browsers!!
Thanks a lot!