After you have created a Coded UI Test and added it to a Team Build, you can run the test from a Microsoft Test & Lab Manager (MTLM). In this post, i will describe the steps to enable this.

 

Since Coded UI Tests always interact with the UI, the Test Agent has to be run as interactive process.

See How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop

 

Step 1: Associate the Coded UI Test to the Test Case.

a. In Visual Studio, Open the Coded UI Test Project.

b. Open the Test Case from Team Explorer.

c. Navigate to the Associated Automation tab.

image

d. Click on … button next to Automated Test Name & Choose the CodedUITestMethod and save the test Case.

image

 

 

Step 2: Setup the environment for running a Coded UI Test.

a. In Microsoft Test & Lab Manager, Navigate to the Lab tab and create a new Physical Environment.

image

Add an available machine to the environment and give it the role of Desktop Client.

image

 

Finish the activity.

 

c. Navigate to the Test Settings tab and create a new Test Settings.

Choose to Run Automated tests.

image

Select the Desktop Client role. The environment that we created earlier matches this role.

image

Finish the activity.

 

d. Navigate to the Testing Center and choose the Properties of the Plan.

Set the Test Settings & Test Environment for Automated Runs.

Set the Filter for Builds and Build in Use also.

image

 

Save and close the Test Plan.

 

e.  Click on Plan activity.

Add the Test Case (seen in Step 1) to the new Test Plan.

image

Step 3: Run the Coded UI Test from Microsoft Test & Lab Manager

Navigate to the Testing Center & choose Test tab.

Right click on the Test Case and choose Run.

 

image

The status of the Test Run is shown in MTLM.

image

 

The Coded UI Test will be run on the specified environment.