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
Introduce a new set of test callbacks used right before and after test execution #27019
Conversation
Thanks for your work @geoand. However, how can I build a jar with these changes? 😅 |
You can do the following: git clone -b #26999 --single-branch git@github.com:geoand/quarkus.git
cd quarkus
mvn -Dquickly -Dformat.skip=true Then use the following BOM: <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>999-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency> |
if I do a
If I do a
Thanks in advance. |
Can you try |
@geoand : Apparently, this feature doesn't work yet. I have created a simple class implementing package cs4r;
import io.quarkus.test.junit.callback.QuarkusTestBeforeTestCallback;
import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
public class MyQuarkusTestBeforeTestCallback implements QuarkusTestBeforeTestCallback {
@Override
public void beforeTest(QuarkusTestMethodContext context) {
System.out.println("beforeTest");
}
} Then (as https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback says) I have created the file
but for some reason I am not aware of yet, the callback is never executed. This is also happening with
is missing. |
Can you share the example project you used? |
PR updated, it should work now (I force pushed to the branch, so best delete your local copy of it) |
@geoand this time it works like a charm 😄 Will this be added in the next release? Thanks in advance. |
Thanks a lot for checking! It will be included in |
I'll finish the PR tomorrow by adding tests |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small naming suggestion change to match the same hooks JUnit provides
...mework/junit5/src/main/java/io/quarkus/test/junit/callback/QuarkusTestAfterTestCallback.java
Outdated
Show resolved
Hide resolved
...mework/junit5/src/main/java/io/quarkus/test/junit/callback/QuarkusTestAfterTestCallback.java
Outdated
Show resolved
Hide resolved
...ework/junit5/src/main/java/io/quarkus/test/junit/callback/QuarkusTestBeforeTestCallback.java
Outdated
Show resolved
Hide resolved
...ework/junit5/src/main/java/io/quarkus/test/junit/callback/QuarkusTestBeforeTestCallback.java
Outdated
Show resolved
Hide resolved
Good point! Fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing doc changes, but the rest looks okay, approved ;)
…t execution These callbacks essentially offer similar functionality to JUnit's org.junit.jupiter.api.extension.BeforeTestExecutionCallback and org.junit.jupiter.api.extension.AfterTestExecutionCallback Closes: quarkusio#26999
I knew I would miss something :) |
Will backport it to the next 2.11 micro. |
Great, thanks! |
These callbacks essentially offer similar functionality to JUnit's
org.junit.jupiter.api.extension.BeforeTestExecutionCallback
andorg.junit.jupiter.api.extension.AfterTestExecutionCallback
Closes: #26999