SWTBot tests do not work with maven, but with Eclipse [message #1784920] |
Thu, 05 April 2018 14:39  |
Eclipse User |
|
|
|
I am still trying to get a proper SWTBot test running. Everything is fine on my local machine, but the test fails (runs in timeout) on Travis.
The test is simple:
@Test
public void createNewProject() {
BasicTests.bot.menu("File").menu("New Project").click();
final SWTBotShell newProjectShell = BasicTests.bot.shell("New ASSIST Project").activate();
final SWTBot newProjectShellBot = newProjectShell.bot();
newProjectShellBot.textWithLabel("&Project name:").setText("ExampleProject");
newProjectShellBot.waitUntil(new DefaultCondition() {
@Override
public String getFailureMessage() {
return "unable to select";
}
@Override
public boolean test() {
return newProjectShellBot.button("Finish").isEnabled();
}
});
newProjectShellBot.button("Finish").click();
BasicTests.bot.waitUntil(Conditions.shellCloses(newProjectShell), 20000);
}
(see [1])
The error log is also pretty short:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running ch.hilbri.assist.gui.tests.TestSuiteAllGUITests
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 24.755 sec <<< FAILURE! - in ch.hilbri.assist.gui.tests.TestSuiteAllGUITests
checkAboutBox(ch.hilbri.assist.gui.tests.basics.BasicTests) Time elapsed: 0.363 sec
createNewProject(ch.hilbri.assist.gui.tests.basics.BasicTests) Time elapsed: 21.969 sec <<< ERROR!
org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 20000 ms.: The shell Shell with text {New ASSIST Project} did not close.
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:522)
at org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.waitUntil(SWTWorkbenchBot.java:1)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:496)
at org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.waitUntil(SWTWorkbenchBot.java:1)
at ch.hilbri.assist.gui.tests.basics.BasicTests.createNewProject(BasicTests.java:43)
(see [2], line 43 corresponds to the waitUntil condition).
Do you have any idea, why the shell closes on my local machine just fine, but not on travis? Even with a timeout of 20s?
Thank you for any insight.
Robert
[1]: https://github.com/RobertHilbrich/assist-public/blob/master/ch.hilbri.assist.gui.tests/src/ch/hilbri/assist/gui/tests/basics/BasicTests.xtend
(yes, I write in Xtend, but you can see the compiled version above)
[2]: https://travis-ci.org/RobertHilbrich/assist-public
[Updated on: Fri, 06 April 2018 14:04] by Moderator
|
|
|
|
Re: SWTBot tests do not work with maven, but with Eclipse [message #1785123 is a reply to message #1784995] |
Mon, 09 April 2018 14:23  |
Eclipse User |
|
|
|
Sorry for all the fuss. I got to the root cause of this issue and fixed it. It was not the fault of SWTbot. Instead my maven surefire plugin was missing some dependencies. Due to these missing dependencies, the performFinish method of the Wizard failed with an exception that was not caught properly. That is the reason, why the dialog did not close during the ui test.
|
|
|
Powered by
FUDForum. Page generated in 0.03849 seconds