|Re: SWTBot and active Eclipse window [message #552035 is a reply to message #552027]
||Tue, 10 August 2010 15:16
| Pascal G
Registered: July 2009
On 10-08-10 10:41 AM, Petar Petrov wrote:|
> We've been using SWTBot very successfully for several months now and we
> can say it's a great framework. What has been bothering us, though, is
> the fact that tests start to fail when Eclipse looses focus. Do you
> think the algorithm for finding the active shell can be changed somehow
> so that it works even if Eclipse is not the active application?
> Petar P
I don't know how much work would be required to do so (or even if it's
possible), but there's already some workaround that works very well. The
simplest (I think) is to run your SWTBot tests in a virtual desktop,
such as another X Display in Unix. The CI Faq  can probably give you
some pointers on how to make this work.
Really, Unix/Linux is a charm to make this work, you wouldn't believe
how easy it is. Launch vncserver once (for the initialize/password
mumbo-jumbo), kill it, locate its xstartup script (usually
~/.vnc/xstartup), add two simple lines at the beginning or uncomment
them ("unset SESSION_MANAGER" and "exec /etc/X11/xinit/xinitrc"),
relaunch vncserver and you got a perfect virtual display to run SWTBot
Then, in your Run Configuration, in the Environment tab, add the DISPLAY
variable with the proper value outputed from vncserver (usually :1 or
:2). You can now launch your tests in a virtual desktop and continue
doing what you were doing.
Wow, while writing this I just found out this might be helpful during
debug :D I think I'm going to start doing this from now on (if I ever
need to launch my tests manually).
Be wary that I only have tested this under Linux. It might or might not
work under another OS. All you need is being able to launch multiple X
Display. Maybe Cygwin can help under Windows, but even then...
Back on the "active shell" problem, I don't think it's possible to do
what you propose, since finding the active shell probably requires
asking SWT the active shell, or at least asking a shell if it is active,
and as such SWTBot has no control over this.
Hope this helps. This ended up as a much longer explanation then I first
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/
*Because performance matters.*
Powered by FUDForum
. Page generated in 0.03415 seconds