I have a simple view, usually registered in my Eclipse plugin (4.5.2), and it works when I start an Eclipse instance using the plugin. It still works in the corresponding test case, which has the following method:
@Before public void setUp() throws Exception { IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); for (IViewReference viewReference : activePage.getViewReferences()) { activePage.hideView(viewReference); } activePage.showView("org.acme.MyView"); }
However, when I run the same test with Tycho (0.22, 0.24 or 0.25), I get the following exception:
java.lang.NullPointerException: null at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1271) at org.eclipse.ui.internal.WorkbenchPage$12.run(WorkbenchPage.java:4238) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4234) at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4214) at org.acme.MyViewTest.setUp(MyViewTest.java:39)
Tycho code is simple:
<plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-surefire-plugin</artifactId> <configuration> <providerHint>junit4</providerHint> <useUIHarness>true</useUIHarness> </configuration> </plugin>
I found this error and a couple more, but I did not find anything, explaining why in Tycho this fails. And I could not find anything about how to fix it.
So what have I done wrong? How to fix it?
source share