Ask a Question

Detecting (and pausing) on a locked session


Detecting (and pausing) on a locked session

So our group has a number of Test Complete tests that have long running database queries. I run the tests on a remote machine and sometimes the machine gets locked (due to a timeout thing) and then all the tests in our suite fail after that test.


I've pursued trying to extend the timeout period so that it would be longer than the query that was being called, but the security group doesn't appear to want to let us do that.


As an alternative, can Test Complete detect that the user session is locked and wait for it to become unlocked?

Esteemed Contributor

Unfortunately, not really right out of the box...  

Since the "locked" message shows up as an error in the test log, you may be able to leverage the OnLogError event handler and detect the locked message... when it shows up in the log, execute a "wait" loop, waiting for a desktop or something.

As to the underlying problem... what architecture is underneath your tests?  Are they running on a Virtual Machine?  If so, you can work with your security team to put an exception on that machine in their group policy and then use tscon to set the machine to be in a "console" session.  This basically means the machine is unlocked but, unless you have access to the host box that is hosting the VM, you can't get to the desktop... just as secure as "locking" the individual machine... this is how we do things.

Alternatively, if you're running a database query, that means you're not interacting with the desktop... this is probably what's generating the timeout.  What others have done in the past set up a timer object in TestComplete that, every so many seconds, you just move the mouse a bit.  

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

They're running on a remote server. I'm not sure if it's a VM or not. The mouse moving script does sound interesting. I wonder if someone has an example of that.


I could try the stack on warning, not sure if that would conflict with how our suite is set up, but I think i could adapt that to make it pause when it runs into an issue.

Showing results for 
Search instead for 
Did you mean: