Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Put JUnit 5 eclipse-plugin-tests without legacy org.junit dependency?

Hi,

I have a Tycho (1.4.0) project where I want to use JUnit 5.

According to the Wiki [1], I have to require both the
org.junit.jupiter.api and the (legacy) org.junit bundles from my
eclipse-plugin-tests.

As I don't have legacy tests and find it annoying to have two versions
of the @Test annotation on the class path (easy to pick the wrong one in
an Import Quick Fix), I tried removing the org.junit dependency.

Unfortunately, this results in a (non-fatal) exception during test
execution:

> WARNING: TestEngine with ID 'junit-vintage' failed to discover tests
> java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
> 	at org.junit.vintage.engine.discovery.VintageDiscoverer.<init>(VintageDiscoverer.java:48)
> 	at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:65)
> 	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130)
> 	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
> 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:82)
> 	at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:56)
> 	at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:102)
> 	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:129)
> 	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:206)
> 	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:161)
> 	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:84)
> 	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:108)
> 	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
> 	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
> 	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
> 	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5113)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4666)
> 	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
> 	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
> 	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
> 	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:635)
> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
> 	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> 	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
> 	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:31)
> 	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:120)
> 	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:37)
> 	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660)
> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1468)
> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1441)

Explicitly selecting the "junit5" provider using a <providerHint>
doesn't help; the tycho-surefire-plugin still insists to use the
"junit-vintage" test engine under the hood.

Does there exist a workaround that avoids the above exception being
logged? Or should I file a bug?

Best wishes,

Andreas

[1] <https://wiki.eclipse.org/Tycho/How_Tos/JUnit5>

-- 
Dr. Andreas Sewe | sewe@xxxxxxx | +49 152 56342856
CQSE GmbH | Centa-Hafenbraedl-Strasse 59 | 81249 Muenchen | www.cqse.eu
Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top