In this post, i will describe the steps required to add a Coded UI Test in a Build Definition.

Pre-requisites:-  An existing Coded UI Test Project, A Connection to Team Foundation Server

0. On the Build Server, we need to run the Team Build Service Host as an interactive process, since it will Coded UI Tests which interact with the desktop.

0.a. Open Team Foundation Server Administration Console, ad click on the Team Foundation Build Configuration.

image

0.b. Click on Properties link for the Build Service Host.

Click “stop to make changes” and choose to Run the Build Service as “Interactive Process”.

            image

0.c. Click Start.

This will start the Build Service Host as an interactive process.

 

1. In the Solution Explorer, right click on the Coded UI Test Solution and choose Add Solution to Source Control.

image

2. Choose the folder in which you want to add this solution.

image

3. In the Pending Changes window, add a Comment and check in the code.

image

 

4. Open Team Explorer and Create a New Build Definition

image

 

5. Specify a name for the Build.

image

6.  Leave the Trigger & Workspace tabs unchanged. [The default values are sufficient]

7. In the Build defaults tab, specify the Build Controller & a drop folder for the build.

image

8. In the Process tab, specify Projects to Build (select the project that you checked in in step 3).

By default all tests in assembles matching *test*.dll will be run.

image

9. Save the Build Definition and Queue a new build.

image

10. In the Build Explorer, you can see the status of the Queued Builds. Double click on a Build to see its log.

image

In the detailed log, you can see the Coded UI Test getting compiled and then run.

image 

image