Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Automated test execution without showing display
Automated test execution without showing display [message #1780458] Mon, 22 January 2018 16:30 Go to next message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
Hi all,

we would like to execute our SWTBot tests on a jenkins build slave (win server 2012). The build is triggered remotely and no one is watching the desktop. This works reliably for some functionality (e.g. click buttons, modify text in textfields...) but not for others (e.g. Keyboard interaction).

If we log in remotely to the build machine, everything works as expected. Usually I would say: okay, we obviously need an active desktop session for this to work. But: sometimes our build does actually work without any desktop actively being open.

Does anyone know what could be going on?
Re: Automated test execution without showing display [message #1780464 is a reply to message #1780458] Mon, 22 January 2018 19:13 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
Hi Robert,

While most interactions with widgets in SWTBot is done by simulating SWT events, keyboard interaction is different, depending on the strategy (SWTBotPreferences.KEYBOARD_STRATEGY). The default for that preference is to use AWTKeyboardStrategy, which uses java.awt.Robot to send keystrokes to the application, and that should be received by the widget that has keyboard focus.

We too have been noticing more issues with the keyboard lately. It seems that something has changed in the platform or in the window manager, where sometimes no shell has the keyboard focus at all, and keystrokes just get lost. It's like we should no longer assume that when a new shell or dialog is opened, it will automatically get focus, whereas this used to be the case before. There was even a case with SWTBot's own unit tests where the key SPACE needed to be pressed before the widget got keyboard focus... we would tell SWTBot to type "Hello World" and the widget would only receive the keystrokes for "World"...

We have had some luck by making sure tests activate the newly opened shell/dialog with SWTBotShell.activate() before interacting with it. Also, if applicable, make sure that the appropriate widget has keyboard focus.

I hope this helps, and please let us know your findings if you can get your tests to work.

Patrick
Re: Automated test execution without showing display [message #1780743 is a reply to message #1780464] Fri, 26 January 2018 14:38 Go to previous message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
Hi Patrick,

we found a way now to run the tests without modifying the keyboard strategy or any swtbot settings.

In our case, the reason for the failing tests was probably this:
* We logged on to our build machine via RDP
* We disconnected the RDP session => this automatically locks the machine
=> Keyboard interactions are not working correctly anymore

>Here< I found a description of the same problem. The solution is to use a bat script to disconnect the RDP session (you need admin rights):

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
  %windir%\System32\tscon.exe %%s /dest:console
)
Previous Topic:SWTBot Recorder is not absolute
Next Topic:SWTBot and E4 RCP Applications - Status?
Goto Forum:
  


Current Time: Sat Apr 20 00:56:16 GMT 2024

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

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

Back to the top