|SWTBot has different behaviour depending if the window is top-most or not [message #559347]
||Thu, 16 September 2010 08:57
| Gabriel Petrovay
Registered: July 2009
I have a test suite that when I start by hand from Eclipse runs successfully. But when I run it from a task (Windows' Task Scheduler) the some tests constantly fail.
One such problem is because the Window is not top-most when started from the Task Scheduler. To simplify this, this test also fails if you start it from Eclipse and you make another windows top-most such that the Eclipse SWTBot starts is not any more the top-most one.
The test fails because of the timeout waiting for a shell to be active:
bot.waitUntil(Conditions.shellIsActive("Errors in Workspace"));
But since the focus is on another window, the shell will never be active (having focus).
Consider that you have all these pop-ups in Eclipse like "Do you want to open the associated perspective?", "Save file", "Errors in Workspace", etc. that tou want to close. Do you know ways to work around this "sleep until active" condition? More precisely, to make the tests independent of whether the window is top most or not.
I can not control how the Eclipse application started (top-most or not). In my scenario Task Scheduler calls a batch script. This calls the ant batch script available in the eclipse/plugins/org.apache.ant.../bin. And this loads the tests.xml ant script that contains the target as described on the page http://wiki.eclipse.org/SWTBot/Ant#Ant .