Ask a Question

Team Foundation Server: TestComplete fails to access GUI objects


Team Foundation Server: TestComplete fails to access GUI objects

Hello everyone,

I'm trying to run TestComplete tests via Team Foundation Server, calling a batch script with command line commands as in

This works fine as long as I call the script on the Server where TC is installed, logged in remotely.


If I call the batch skript as a build step in TFS, the test starts running, performing nun-GUI tasks like logging the first messages. As soon as the test tries to click the first GUI button, the test fails saying "The operation cannot be performed, because the user session is non-interactive".

When I started the same scripts using Windows' task schedule; there was a similar problem that could be solved as explained in, but I fail to find an analogue solution for tfs.


Thanks in advance,


Community Hero

If it's part of the build process, you probably need to start that as an interactive session.


This isn't something I've ever done myself, but this looks like it might be helpful?

Thanks a lot, this looks like it's worth trying...tomorrow.

I'll keep you updated if it finally solved the problem and mark your post as answer if it does.

Starting it as interactive is the first step. However, you will still need to make sure that there is a user session logged in with some sort of active UI available. You don't necessarily need to have a monitor up and running or anything like that but you can't click on a UI if there is no UI.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Thanks a lot, I can now organize and run my tests from Team Foundation Server.


But as Tristaanogre pointed out, I still have to have an active GUI...which I expected, since it was the same when I used to run the tests from batch scripts via the Windows task schedule.

Thing is: The way I understood it, Team Foundation Server itself should be able to open and keep a user session with GUI access, since it uses the build PC as a user to log on to the server where the tests are executed - I thought this would remove the need of a human user logged onto the test execution server.

Anyone can help on this please?


Thanks in advancem



Edit: The message is "The job has been abandoned because agent xxx-CI-Agent did not renew the lock. Ensure agent is running, not sleeping, and has not lost communication with the service.", which might be a TFS issue of its own, rather than an error in my approach...

We have a build guy who deals with this stuff, so I've never been involved directly, but you may get some helpful suggestions here:


... your options sound like they'll depend on the version of TFS you're using. I see TeamCity mentioned in there. That's what our build guy was using to trigger my automated tests .... which required an active user session/GUI.

I decided to mark as solved, since the problem described in the title and my first post are solved, and the "new" issue seems to be TFS only rather than having to do with TestComplete:

TFS can not even deploy the test agent on the build PC without me having an open remote desktop connection, saying "The job has been abandoned because agent XX did not renew the lock. Ensure agent is running, not sleeping, and has not lost communication with the service."


Thanks to everyone who contributed here.

Showing results for 
Search instead for 
Did you mean: