Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit 5.11.0 support #160

Closed
ryanemerson opened this issue Sep 23, 2024 · 3 comments
Closed

JUnit 5.11.0 support #160

ryanemerson opened this issue Sep 23, 2024 · 3 comments

Comments

@ryanemerson
Copy link

Which JUnit versions are supported currently and planned to be supported in the future? We (Infinispan) are currently using JUnit 5.10.3, however when we upgrade to 5.11.0 our build fails with:

[ERROR] There was an error in the forked process
 TestEngine with ID 'junit-jupiter' failed to discover tests
 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:99)
 	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:77)
 	at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42)
 	at org.apache.maven.surefire.junitplatform.LazyLauncher.discover(LazyLauncher.java:50)
 	at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:52)
 	at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:87)
 	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:142)
 	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
 	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
 	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
 Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'org.infinispan.remoting.MessageSentToLeaverTest', classLoader = null] resolution failed
 	at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:103)
 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
 	at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:48)
 	at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)
 	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
 	... 15 more
 Caused by: java.lang.NoSuchMethod'boolean org.junit.platform.commons.util.ReflectionUtils.returnsPrimitiveVoid(java.lang.reflect.Method)'
 	at org.junit.jupiter.engine.discovery.predicates.IsTestableMethod.test(IsTestableMethod.java:48)
 	at org.junit.jupiter.engine.discovery.predicates.IsTestMethod.test(IsTestMethod.java:23)
 	at org.junit.jupiter.engine.discovery.predicates.IsTestableMethod.test(IsTestableMethod.java:26)
 	at java.base/java.util.function.Predicate.lambda$or$2(Predicate.java:101)
 	at java.base/java.util.function.Predicate.lambda$or$2(Predicate.java:101)
 	at org.junit.platform.commons.util.ReflectionUtils.findMethod(ReflectionUtils.java:1410)
 	at org.junit.platform.commons.util.ReflectionUtils.isMethodPresent(ReflectionUtils.java:1306)
 	at org.junit.jupiter.engine.discovery.predicates.IsTestClassWithTests.hasTestOrTestFactoryOrTestTemplateMethods(IsTestClassWithTests.java:50)
 	at org.junit.jupiter.engine.discovery.predicates.IsTestClassWithTests.test(IsTestClassWithTests.java:46)
 	at org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:67)
 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135)
 	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
 	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1685)
 	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
 	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
 	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
 	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189)
 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126)
 	at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92)
 	... 20 more
@sormuras
Copy link
Member

Sounds like a version conflict (JUnit Platform not in sync with Jupiter artifacts) within the Maven configuration of your project.

See junit-team/junit5#3933 for a solution.

Why did you open this issue against the TestNG-Engine repository? 🤔

@ryanemerson
Copy link
Author

Sorry for the confusion. We're using the testng-engine with JUnit5 as we have a very "mature" testsuite that hasn't been migrated to JUnit yet. When discussing the issue, we wrongly identified testng-engine as being the source of the problem, hence the issue being raised here.

Upgrading the org.junit.platform dependencies fixed the issue, thanks for pointing me in the right direction 🙂

@marcphilipp
Copy link
Member

For Maven we generally recommend importing the BOM to avoid such issues.

@marcphilipp marcphilipp closed this as not planned Won't fix, can't repro, duplicate, stale Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants