Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Run as JUnit Test: TestEngine with ID 'junit-jupiter' failed to discover tests(Error while trying to run class as JUnit Test)
Run as JUnit Test: TestEngine with ID 'junit-jupiter' failed to discover tests [message #1856142] Tue, 22 November 2022 17:33 Go to next message
Simon Cockx is currently offline Simon CockxFriend
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 #1856159 is a reply to message #1856142] Wed, 23 November 2022 17:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
Hi
On 22/11/2022 17:33, Simon Cockx wrote:
> 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

This is a too-regular occurrence with new Eclipse builds [1].

The problem is the use of fragments and so the provision of a given package from more that one 'plugin'. When code improvements occur only 'changed' plugins are rebuilt and so the changed plugins get new signing while the 'unchanged' plugins can retain old incompatible signing.

Sadly the relevant JUnit test suites are inadequate to diagnose this regular problem and so it is left to the bleeding edge user to have trouble [2].

Sadly again the releng action to ensure that plugins are changed coherently is also outstanding after many years.

Workaround: go back to an earlier Eclipse release.

Regards

Ed Willink

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=573306

[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=466991
Re: Run as JUnit Test: TestEngine with ID 'junit-jupiter' failed to discover tests [message #1856172 is a reply to message #1856159] Thu, 24 November 2022 08:34 Go to previous messageGo to next message
Simon Cockx is currently offline Simon CockxFriend
Messages: 69
Registered: October 2021
Member
Thanks. Going back to 2022-06 solved it. Come to think of it, I recently switched laptops and had the latest version of Eclipse installed, which was apparently the start of my trouble.
Re: Run as JUnit Test: TestEngine with ID 'junit-jupiter' failed to discover tests [message #1856190 is a reply to message #1856172] Fri, 25 November 2022 10:48 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1814
Registered: July 2009
Location: Firenze, Italy
Senior Member
I started to have the same problem, but I can't believe one has to go back to 2022-06... really there's no other solution?

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 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1814
Registered: July 2009
Location: Firenze, Italy
Senior Member
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)"


Previous Topic:Views are created in SQL Server
Next Topic:Eclipse Java when I try @Test a fairly long
Goto Forum:
  


Current Time: Fri Oct 11 07:17:45 GMT 2024

Powered by FUDForum. Page generated in 0.03317 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top