Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot and Xvfb
SWTBot and Xvfb [message #484090] Fri, 04 September 2009 09:19 Go to next message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
Hi, I am new to SWTBot and like it a lot. Thanks for a great product!

Has anyone experience with running SWTBot testsuites under a virtual
framebuffer (Xvfb)? Some of my tests do not work under Xvfb and I do not
know why. I get e lot of "Could not find widget" errors. When I run the
suite with a "real" X11 system all widgets are found.

Another issue with the virtual framebuffer is that
SWTUtils.captureScreenshot() doesn't seem to work. It just creates a
white (empty) image.

Thanks for any tips
Peter
Re: SWTBot and Xvfb [message #484347 is a reply to message #484090] Mon, 07 September 2009 06:46 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Hi Peter,

I've not tried using Xvfb for running swtbot tests yet.

All our tests run in a proper login shell (we use gnome) and that seems
to work well for us.

I think the errors are primarily because xvfb does not have a proper
window manager, try running gnome in the xvfb session and things should
work fine.

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr

On 04/09/09 2:49 PM, Peter Kullmann wrote:
> Hi, I am new to SWTBot and like it a lot. Thanks for a great product!
>
> Has anyone experience with running SWTBot testsuites under a virtual
> framebuffer (Xvfb)? Some of my tests do not work under Xvfb and I do not
> know why. I get e lot of "Could not find widget" errors. When I run the
> suite with a "real" X11 system all widgets are found.
>
> Another issue with the virtual framebuffer is that
> SWTUtils.captureScreenshot() doesn't seem to work. It just creates a
> white (empty) image.
>
> Thanks for any tips
> Peter
Re: SWTBot and Xvfb [message #484397 is a reply to message #484347] Mon, 07 September 2009 11:53 Go to previous messageGo to next message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
Hi Ketan,

thanks for the ideas. I made some more tests and noticed two things:
1. Screeshots do in fact work in the Xvfb setting - don't know what was
wrong last week...
2. The problem with the "could not find widget" errors seems related to
the fact that Display.getActiveShell() returns null in Xvfb whereas this
is non-null in an interactive setting.

I tried to activate the shell but it doesn't help:

@Test
public void testGetActiveShell() throws Exception {
final Display display = PlatformUI.getWorkbench().getDisplay();
UIThreadRunnable.syncExec(new VoidResult() {
public void run() {
display.getShells()[0].setActive();
}
});
Shell activeShell = UIThreadRunnable.syncExec(display,
new WidgetResult<Shell>() {
public Shell run() {
log.debug("BBB1: display has #of shells: "
+ display.getShells().length);
return display.getActiveShell();
}
});
assertNotNull(activeShell); // fails on Xvfb
}

Regards,
Peter



Ketan Padegaonkar schrieb:
> Hi Peter,
>
> I've not tried using Xvfb for running swtbot tests yet.
>
> All our tests run in a proper login shell (we use gnome) and that seems
> to work well for us.
>
> I think the errors are primarily because xvfb does not have a proper
> window manager, try running gnome in the xvfb session and things should
> work fine.
>
Re: SWTBot and Xvfb [message #484404 is a reply to message #484397] Mon, 07 September 2009 12:09 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 07/09/09 5:23 PM, Peter Kullmann wrote:
> Hi Ketan,
>
> thanks for the ideas. I made some more tests and noticed two things:
> 1. Screeshots do in fact work in the Xvfb setting - don't know what was
> wrong last week...
> 2. The problem with the "could not find widget" errors seems related to
> the fact that Display.getActiveShell() returns null in Xvfb whereas this
> is non-null in an interactive setting.
>
> I tried to activate the shell but it doesn't help:

I've noticed this as well. I *think* this happened to me because the
shell did not actually have a proper "window" with a border, title bar
etc, and *apparently* it's not possible to get the title because it does
not have a title bar.

Just an educated guess based on an observation. I may be completely off
on a tangent.

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr
Re: SWTBot and Xvfb [message #484549 is a reply to message #484404] Tue, 08 September 2009 08:17 Go to previous message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
Now, I think I have found a solution: Shell.forceActive() helps. In my
RCP tests I will use something like this:

@Before
public void setUp() throws Exception {
UIThreadRunnable.syncExec(new VoidResult() {
public void run() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShel l()
.forceActive();
}
});
}



Ketan Padegaonkar schrieb:
> On 07/09/09 5:23 PM, Peter Kullmann wrote:
>> Hi Ketan,
>>
>> thanks for the ideas. I made some more tests and noticed two things:
>> 1. Screeshots do in fact work in the Xvfb setting - don't know what was
>> wrong last week...
>> 2. The problem with the "could not find widget" errors seems related to
>> the fact that Display.getActiveShell() returns null in Xvfb whereas this
>> is non-null in an interactive setting.
>>
>> I tried to activate the shell but it doesn't help:
>
> I've noticed this as well. I *think* this happened to me because the
> shell did not actually have a proper "window" with a border, title bar
> etc, and *apparently* it's not possible to get the title because it does
> not have a title bar.
>
> Just an educated guess based on an observation. I may be completely off
> on a tangent.
>
Previous Topic:Wait for progressmonitordialog close
Next Topic:SWTBot Spy Plugin
Goto Forum:
  


Current Time: Tue Apr 23 08:07:36 GMT 2024

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

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

Back to the top