Run as JUnit Test: TestEngine with ID 'junit-jupiter' failed to discover tests [message #1856142] |
Tue, 22 November 2022 17:33 |
Simon Cockx Messages: 69 Registered: October 2021 |
Member |
|
|
I've been using Eclipse just fine over the last year now. However, since a couple of days, I'm suddenly not able to run JUnit tests anymore from Eclipse.
This used to work fine: right-click a class > Run As > JUnit Test.
However, now the tests don't run anymore and I'm seeing the following error:
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:78)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.discover(DefaultLauncherSession.java:81)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:46)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.<init>(JUnit5TestReference.java:46)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:108)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:51)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:513)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.SecurityException: class "org.junit.jupiter.api.extension.ExtensionContext"'s signer information does not match signer information of other classes in the same package
at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1150)
at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:905)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:68)
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
... 14 more
I've tried reinstalling Eclipse (https://stackoverflow.com/questions/50854359/how-to-uninstall-eclipse), removing the eclipse-workspace/.metadata folder, clearing my .m2/repository, etc.
The tests run fine with Maven. A colleague of mine doesn't have this problem - he can run it from Eclipse fine too.
Any ideas what might be causing this?
Kind regards
Simon
[Updated on: Tue, 22 November 2022 17:41] Report message to a moderator
|
|
|
|
|
|
Re: Run as JUnit Test: TestEngine with ID 'junit-jupiter' failed to discover tests [message #1856191 is a reply to message #1856190] |
Fri, 25 November 2022 10:57 |
|
OK, I found the root of the problem and it's a misconfiguration in the MANIFEST:
jupiter bundles must NOT be required bundles, they must be imported packages, e.g.:
Import-Package: org.junit.jupiter.api;version="[5.1.0,6.0.0)",
org.junit.jupiter.api.function;version="[5.1.0,6.0.0)",
org.junit.jupiter.params;version="[5.1.0,6.0.0)",
org.junit.jupiter.params.provider;version="[5.1.0,6.0.0)",
org.junit.jupiter.api.extension;version="[5.1.0,6.0.0)"
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Powered by
FUDForum. Page generated in 0.03331 seconds