Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot in headless mode and java.lang.ExceptionInInitializerError(headless problems)
SWTBot in headless mode and java.lang.ExceptionInInitializerError [message #1797800] Tue, 06 November 2018 14:16 Go to next message
Alex Gor is currently offline Alex GorFriend
Messages: 159
Registered: November 2014
Location: Russia
Senior Member
We meet the following problem. In case we try to excute our automated test suite unde Jenkins management we receive java.lang.ExceptionInInitializerError in test that work with keyboard. Executing tests unde Jenkins control means that SWTBot in headless mode. Our target platform is Windows 10. According to SWTBot developer notes the headless mode is not tested under windows. We use SWTBot version 2.2.1. In case we execute SWTBot test suite on remote vitual machine without Jenkins. This issue is not observed. Also our investigation show us that this issue can be reproduced on local machine in case keyboard layout is not found. So, I suppose the root cause of this issue is missing physical keyboard in this case. Also we take into consideration java.lang.ExceptionInInitializerError says us that something wrong occures in initialization static variables

My investigation demonstrated that this issue is occured when test tries to push a key. Partially this problem can be resolved by using setText method instead of typeText. But we have set of tests that verify processing of keyboard combination like Alt+A or pushing Enter for example.

The application under testing is Eclipse RCP application that based on very old Eclipse platform (version 3.6)
Re: SWTBot in headless mode and java.lang.ExceptionInInitializerError [message #1797807 is a reply to message #1797800] Tue, 06 November 2018 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Please post the full stack trace. An `ExceptionInInitializer` means that there was an exception in a static or class initializer. A simple "swtbot ExceptionInInitializerError" produces a number of discussions of different causes.
Re: SWTBot in headless mode and java.lang.ExceptionInInitializerError [message #1797835 is a reply to message #1797807] Wed, 07 November 2018 09:21 Go to previous messageGo to next message
Alex Gor is currently offline Alex GorFriend
Messages: 159
Registered: November 2014
Location: Russia
Senior Member
<error type="java.lang.ExceptionInInitializerError">java.lang.ExceptionInInitializerError
at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeCharacter(Keyboard.java:100)
at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeText(Keyboard.java:89)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SWTBotText.java:92)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SWTBotText.java:78)
at org.fusion.framework.Utils.TextFieldUtils.lambda$setTextByToolTip$1(TextFieldUtils.java:40)
at org.fusion.framework.Base.BaseSafeUtil.performAction(BaseSafeUtil.java:64)
at org.fusion.framework.Utils.TextFieldUtils.setTextByToolTip(TextFieldUtils.java:40)
at org.fusion.framework.Utils.RegressionScopeUtils.StartSearchInIB(RegressionScopeUtils.java:480)
at org.fusion.tests.perspectives.ibrowser.PAloeschenBNGMMverfuegbar.ANbearbeiten2(PAloeschenBNGMMverfuegbar.java:41)
at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner.run(SWTBotJunit4ClassRunner.java:54)
at org.fusion.tests.suites.FlexprodSuite.runChild(FlexprodSuite.java:155)
at org.fusion.tests.suites.FlexprodSuite.runChild(FlexprodSuite.java:17)
at org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner.run(EclipseTestRunner.java:350)
at org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner.run(EclipseTestRunner.java:208)
at org.eclipse.swtbot.eclipse.junit.headless.UITestApplication.runTests(UITestApplication.java:116)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
at java.lang.Thread.run(Unknown Source)
at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKeyboardLayout(KeyboardLayout.java:89)
at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getDefaultKeyboardLayout(KeyboardLayout.java:75)
at org.eclipse.swtbot.swt.finder.keyboard.Keystrokes.&lt;clinit&gt;(Keystrokes.java:110)
</error>

By the way I found a recomendation set keyboard layout in command line, something like : -Duser.language=en -Duser.region=US. Is it correct way?

[Updated on: Wed, 07 November 2018 09:26]

Report message to a moderator

Re: SWTBot in headless mode and java.lang.ExceptionInInitializerError [message #1797859 is a reply to message #1797835] Wed, 07 November 2018 14:28 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
Hi Alex,

This line: at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKeyboardLayout(KeyboardLayout.java:89) is:

throw new IllegalArgumentException(layoutName + ".keyboard not found, see http://wiki.eclipse.org/SWTBot/Keyboard_Layouts for more information.");

It would seem that the keyboard autodetected at runtime is not found. I see only EN_US, FR_FR and DE_DE keyboards built-in the plug-in.

In our tests we usually add this line in the initialization code of tests that use the keyboard, it makes the test immune to the user's locale:

SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";

From command line you could also try -Dorg.eclipse.swtbot.keyboard.layout=EN_US

Setting the language and region of the locale system property might work too. Let us know ;)

Patrick
Re: SWTBot in headless mode and java.lang.ExceptionInInitializerError [message #1797866 is a reply to message #1797859] Wed, 07 November 2018 16:11 Go to previous messageGo to next message
Alex Gor is currently offline Alex GorFriend
Messages: 159
Registered: November 2014
Location: Russia
Senior Member
Patrick

Thankr you very much. It works. I used this one : SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";

[Updated on: Wed, 07 November 2018 16:12]

Report message to a moderator

Re: SWTBot in headless mode and java.lang.ExceptionInInitializerError [message #1797886 is a reply to message #1797866] Thu, 08 November 2018 07:48 Go to previous message
Alex Gor is currently offline Alex GorFriend
Messages: 159
Registered: November 2014
Location: Russia
Senior Member
By the way one question. Our framework works correctly on real machine with physical keyboard without this prefernce, But does not work in headless mode. What is the reason of this behaviour?
Previous Topic:Run SWTBot test in Headless mode. RCP application is not started
Next Topic:Release planned for Eclipse 2018-12?
Goto Forum:
  


Current Time: Thu Apr 25 14:28:17 GMT 2024

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

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

Back to the top