snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

QuarkusTestBeforeAllCallback is run before every @Test method #184

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 3 years ago

Describe the bug Implementing QuarkusTestBeforeAllCallback like follows

public class CustomBeforeAllCallback implements QuarkusTestBeforeAllCallback{
    @Override
    public void beforeAll(Object testInstance) {
        System.out.println("before all message");
    }
}

Test methods like follows

    @Test
    public void testHelloEndpoint() {
        System.out.println("first");
    }

    @Test
    public void anotherTest() {
        System.out.println("second");
    }

gives me

before all message
second
before all message
first

Expected behavior The callback is run before all @Test methods only once. So in case of example it would look like

before all message
second
first

Actual behavior The callback is run before every @Test method.

To Reproduce

Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).

Or attach an archive containing the reproducer to the issue. code-with-quarkus 2.zip

Steps to reproduce the behavior:

  1. Unzip reproducer
  2. Run mvn clean test

Configuration

# Add your application.properties here, if applicable.

Screenshots (If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

 - Output of `java -version`:  

openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)

 - GraalVM version (if different from Java): 
 - Quarkus version or git rev: 
1.8.1.Final ``` - Build tool (ie. output of `mvnw --version` or `gradlew --version`): ``` Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00) ``` **Additional context** (Add any other context about the problem here.) --- https://github.com/quarkusio/quarkus/issues/12250 --- $upstream:12250$