quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.35k stars 2.56k forks source link

Quarkus spock extension #30221

Open roggenbrot opened 1 year ago

roggenbrot commented 1 year ago

Description

Currently using @QuarkusTest in a spock test case is not supported by Quarkus #6506

This is caused by Spock using its own extension mechanism, and not handle JUnit5 annotations out of the box.

There are projects which aim to provide a compatibility/wrapper layer (e.g. spock-junit5), but since these projects currently do not support interceptors (which the quarkus JUnit5 extension heavily relies on) , these libraries won't help to excute quarkus test case with spock.

I've writtem a small extension/library which tries to solve this issue by registering a custom spock extension (IAnnotationDrivenExtension) which delegates all spock lifecycle methods to the corresponding JUnit5 method interceptor handler in the quarkus Junit5 extension.

You can find the POC here: https://github.com/roggenbrot/quarkus-spock

Interested in this extension, please +1 via the emoji/reaction feature of GitHub (top right).

Repository name

quarkus-spock

Short description

Running quarkus tests with spock

Repository Homepage URL

https://quarkiverse.github.io/quarkiverse-docs/spock/dev/

Repository Topics

Team Members

-

GitHub Applications?

Additional context

No response

fernando88to commented 1 year ago

With the creation of an official extension for groovy ( https://github.com/quarkiverse/quarkus-groovy ) this one could also be approved.

Hubbitus commented 11 months ago

Sorry, what is the progress in this area?

As I see maven dependency:

<dependency>
    <groupId>io.quarkiverse.spock</groupId>
    <artifactId>quarkus-spock</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

is absent in maven:

Execution failed for task ':quarkusGenerateCodeTests'.
> Could not resolve all files for configuration ':quarkusTestBaseRuntimeClasspathConfiguration'.
   > Could not find io.quarkiverse.spock:quarkus-spock:1.0-SNAPSHOT.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/io/quarkiverse/spock/quarkus-spock/1.0-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/io/quarkiverse/spock/quarkus-spock/1.0-SNAPSHOT/quarkus-spock-1.0-SNAPSHOT.pom
       - file:/home/pasha/.m2/repository/io/quarkiverse/spock/quarkus-spock/1.0-SNAPSHOT/maven-metadata.xml
       - file:/home/pasha/.m2/repository/io/quarkiverse/spock/quarkus-spock/1.0-SNAPSHOT/quarkus-spock-1.0-SNAPSHOT.pom
       - https://packages.confluent.io/maven/io/quarkiverse/spock/quarkus-spock/1.0-SNAPSHOT/maven-metadata.xml
       - https://packages.confluent.io/maven/io/quarkiverse/spock/quarkus-spock/1.0-SNAPSHOT/quarkus-spock-1.0-SNAPSHOT.pom

And I do not see any movement in this request too.

Meantime, such extension and Spock support will be really great!

fernando88to commented 7 months ago

I tried to do a project with quarkus + spock at the address + extesion of groovy

https://github.com/fernando88to/quarkuswithspock

However, it hasn't worked yet, it seems that the problem is in the integration tests, the tests run but the Quarkus server doesn't.

I thought of an extension that would avoid these problems.

Hubbitus commented 1 month ago

I've built the extension manually and it seems to work. I like it. But I'm afraid to use it in the project, at least until that extension will be pushed to public repos.

fernando88to commented 1 month ago

I've built the extension manually and it seems to work. I like it. But I'm afraid to use it in the project, at least until that extension will be pushed to public repos.

Share the code please.

Hubbitus commented 4 days ago

@fernando88to, what code are you asking about? I've use https://github.com/roggenbrot/quarkus-spock present in initial message of this issue.