Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot and active Eclipse window
SWTBot and active Eclipse window [message #552027] Tue, 10 August 2010 14:41 Go to next message
Petar Petrov is currently offline Petar Petrov
Messages: 10
Registered: July 2009
Junior Member
Hello,

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?

Thanks!
Petar P
Re: SWTBot and active Eclipse window [message #552035 is a reply to message #552027] Tue, 10 August 2010 15:16 Go to previous message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
On 10-08-10 10:41 AM, Petar Petrov wrote:
> Hello,
>
> 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?
>
> Thanks!
> 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 [1] 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
tests!

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.

[1] http://wiki.eclipse.org/SWTBot/CI_Server

Hope this helps. This ended up as a much longer explanation then I first
intended :P
--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Previous Topic:Placing the cursor at a particular position in the editor
Next Topic:Troubles with "java.lang.NoClassDefFoundError: junit/framework/TestListener" in headless m
Goto Forum:
  


Current Time: Sat Sep 20 20:12:34 GMT 2014

Powered by FUDForum. Page generated in 0.01435 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software