Skip to content

Integration Test AfterEach callbacks are not called #31393

Closed

Description

Describe the bug

When a class implementing io.quarkus.test.junit.callback.QuarkusTestAfterEachCallback is created and register with the ServiceRegistry, the afterEach callback method should be called after each test invocation.

The callbacks are not made for Integration Tests

Expected behavior

The callback should be called, in the example shared I would expect the following to appear in the logs;

Test Running: testHelloEndpoint
CutomsTestCallback: afterEach

Actual behavior

The AfterEach callbacks are skipped and never called

How to Reproduce?

Create an Integration test MyTestIt

@QuarkusIntegrationTest
public class MyTestIt {
    @Test
    public void testHelloEndpoint() {
        System.out.println("Test Running: testHelloEndpoint");
        given()
                .when().get("/hello")
                .then()
                .statusCode(200)
                .body(is("Hello from RESTEasy Reactive"));
    }
}

Create a custom test callback

public class CutomsTestCallback implements QuarkusTestAfterEachCallback {

    @Override
    public void afterEach(QuarkusTestMethodContext context) {
        System.out.println("CutomsTestCallback: afterEach");
    }

}

Configure the application to enable IntegrationTest callbacks, application.properties

quarkus.test.enable-callbacks-for-integration-tests=true

Register the callback with ServiceLoader in META-INF/services/io.quarkus.test.junit.callback.QuarkusTestAfterEachCallback

org.acme.CutomsTestCallback

Run Integration test

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions