Executing Test in a test agent during a build

With Tfs Build you have a great flexibility on how to execute your unit tests. First of all you can decide to execute only tests of a certain category, or with a certain priority, but one of the most interesting feature is the ability to execute them in another machine with the helps of a test Agent. First of all you need to install a test controller and configure it in one of the machine:


Since this is a test machine I use administrator as the account, but this is not a good security strategy for production :), the important stuff is that the controller should be not associated with a project collection. Once the test controller is installed and configured you can install test agent on some pc and configure them to point at the controller.


for this example I installed an agent in the same machine of the test controller; when everything is ok you can simply create a testsetting file to set remote test execution.


With this option enabled, tests are executed remotely in an agent  configured with the controller If you run tests you can look at the agent machine to verify that test are actually executed on the remote agent.


Now you can simply configure the build to use this new test settings file.


The advantage of this approach is that you can execute tests in a remote machine, with an agent that has access to the desktop. You can create a dedicated machine for running unit test during the build, expecially if the test machine has some specific characteristics to be satisfied (Es. it must have Sql Server installed to run database test locally, it should have a RAMDISK to speedup test execution, etc).


Published by

Ricci Gian Maria

.Net programmer, User group and community enthusiast, programmer - aspiring architect - and guitar player :). Visual Studio ALM MVP

2 thoughts on “Executing Test in a test agent during a build”

  1. Thank you SO MUCH for this. I was getting really lost in trying to make the Controller connect to the TFS Collection.

    All I needed to do was set the testsettings file and disconnect from the tfs collection.

    Thanks again.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.