In this article, I wanted to share what you should do if you have queued an automated test run on a test controller and its remain in "waiting for test controller” state for quite some time (as shown below). 

WaitingForTestRun

Before we go to the trouble shooting steps, let us spend sometime understanding what happens when you want to queue a test run.

You queue a test run specifying the test environment on which the test run should get executed . For example: – For the test run shown in the above picture, I have queued it against a test environment named “aseemb”.  This queuing of test run essentially means that the run gets stored on the team foundation server and is ready for execution on its test environment. Note that here only the run is ready for execution and not the test environment. The test environment on which you have queued the run might be ready or might not be ready.

The “test environment” is managed by test controller and the test controller is the one who is responsible for managing the execution of the queued runs. Test controller is supposed to pick up the queued runs from the team foundation server and execute them on the environment for which the test run is queued. The logic to pick up the test run is intelligent and it does not pick up the runs which are queued against the environments that are not ready right now and picks up only those runs which are queued against ready environments. The runs which are not picked up by the controller remain in “waiting for test controller” state and the runs which get picked up move to “In Progress” state.

Now let us go back and find out what you should do if you observe that the test run has been in “waiting for test controller” state for quite some time.

1.  Ensure that the test controller is running and is able to communicate with team foundation server (meaning there is no network issue, permission issue etc).

2. (Update on 09/11/2011) Ensure that all the agents in the environment on which you have queued the run are in ready state.

Allagents

3. (Updated on 25/06/2010) Ensure that the test controller account has “View Test Run” permission on the project in which the test run is queued. This is a very rare miss and typically the problem is one of first two options. But in case you manually change the controller account (services.msc) or you have custom groups & have manually edited the permissions, then there is a chance that this permission is not there for the test controller account. To check whether the appropriate permission is there or not, you can run the utility (source code is here) with following parameters.

CheckProjectPermission /collection:http://mytfs:8080/tfs/DefaultCollection /teamProject:P1

                                  /user:mydomain\myaccount /projectPermissionName:ViewTestResults