I´m running UI tests for an RCP application using SWTBot, which works fine while launching the tests in the eclipse IDE. Now I want to run the tests in maven, which also works so far. Unfortunately, through the dependency chain org.eclipse.swtbot.eclipse.finder --> org.eclipse.ui.editors --> org.eclipse.ui.ide the org.eclipse.ui.ide is also present in the application that runs the tests. With this bundle some unexpected menu items are present and the bundle should be excluded in the test runtime. How could this be achieved?
While running the tests in eclipse I simply exclude the org.eclipse.ui.ide bundle in the SWTBot Test launch configuration and everything works as expected.
The dependency chain
org.eclipse.swtbot.eclipse.finder --> org.eclipse.ui.editors --> org.eclipse.ui.idecontains an optional link: the first bundle only requires the second bundle via an optional import of the packageorg.eclipse.ui.texteditor. This is why you can remove theo.e.ui.idebundle from the test runtime launched from Eclipse, ando.e.swtbot.eclipse.finderwill still work.Under normal circumstances, you could achieve the same in Tycho’s test runtime by making sure that the optional dependency is not in the target platform:
But here is why this doesn’t work in your particular case: When you use the UI test harness (
useUIHarness=true), Tycho unconditionally adds the bundleorg.eclipse.ui.ide.applicationas extra requirement to your test runtime. That bundle has a non-optional requirement toorg.eclipse.ui.ide, so with the target platform configuration above, you’ll get a “cannot resolve dependency” error complaining about an unsatisfied constraint oforg.eclipse.ui.ide.application.So, I don’t think that there is a solution in your case – but I consider this a bug in Tycho. The SWT bot tests run in Eclipse, so they should also run in Tycho. Obviously, Eclipse doesn’t need the
org.eclipse.ui.ide.applicationbundle (or otherwise it would have stopped working when you de-selected theorg.eclipse.ui.idebundle), so Tycho shouldn’t need it either. Please file a bug report for Tycho and attach a minimal sample project that reproduces the problem, so that I can fix this.