Search code examples
javaeclipseswtbot

SWTBot - Could not find a display - Eclipse 2020


I'm trying to use SWTBot on Eclipse and run into some trouble when following some tutorials and exemple. On eclipse 2020-09 whenever I try to run a code I get an error due to the method SWTBot() to initialize the bot. Vogella Code In Eclipse 2020

It happened with several tutorials or exemple I followed, like these ones:

https://www.vogella.com/tutorials/SWTBot/article.html

https://wiki.eclipse.org/SWTBot/UsersGuide

Testing SWT GUI with SWTBot

When trying these on a previous version of eclipse 2019-06 it works (or in vogella's exemple, the error are no longer due to the initialization of the bot but to missing elements in UI). Vogella Code In Eclipse 2019

About the code I'm testing: For vogella it's the one in the section 4.3 Create Test.

In the userGuide it's the one in section "Getting started with SWTBot for Eclipse Plugins".

About my run Configurations: On the 2020 I tried with both JUnit plugin test and SWTBot Test. I was careful to not run the test in UI thread as said in documentation. I run the tests with java 1.8 and java 14.

On the 2019 version I tried only with the JUnit Plugin test and without thread UI, I run the tests with java 1.8.

So what I'm looking for is a way to run my tests with SWTBot on the 2020 version. I couldn't find any information about such error. I will gladly provide more informations if you need.


Solution

  • Turns out the problem was not due to a different version of eclipse but to a specific module in another project in my workspace. I remove it and now it's ok.