Skip to content

Kotlin suspend function detection doesn't work when JUnit and test method are in a separate ClassLoader #5375

@geoand

Description

@geoand

When using JUnit 5 in Quarkus, then tests annotated with @QuarkusTest can't take advantage of the new Kotlin suspend function support.

Although there is needs to be work on Quarkus as well for this to work, currently progress is blocked by JUnit not detecting the suspend methods and instead skipping the test method with a warning like:

2026-02-13 15:24:22,254 WARNING [org.junit.platform.launcher.core.DiscoveryIssueNotifier] (main) TestEngine with ID 'junit-jupiter' encountered a non-critical issue during test discovery:

(1) [WARNING] @Test method 'public final java.lang.Object org.acme.QuarkusSuspendTest.suspendingTestShouldRun(kotlin.coroutines.Continuation<? super kotlin.Unit>)' must not return a value. It will not be executed.
    Source: MethodSource [className = 'org.acme.QuarkusSuspendTest', methodName = 'suspendingTestShouldRun', methodParameterTypes = 'kotlin.coroutines.Continuation']
            at org.acme.QuarkusSuspendTest.suspendingTestShouldRun(SourceFile:0)
[INFO] 

I am using the latest Quarkus version which brings in JUnit 6.0.2

Steps to reproduce

With the following reproducer:

code-with-quarkus.zip

simply execute mvn test

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions