We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@Nested classes are not working properly in @QuarkusTest.
@Nested
@QuarkusTest
@Nested tests run without throwing exception
Exception is thrown: java.lang.RuntimeException: Could not find method public void junit.NestedTest.GreetingResourceTest.beforeEach() on test class
java.lang.RuntimeException: Could not find method public void junit.NestedTest.GreetingResourceTest.beforeEach() on test class
Steps to reproduce the behavior:
mvn io.quarkus:quarkus-maven-plugin:1.13.7.Final:create -DprojectGroupId="junit.NestedTest" -DprojectArtifactId=NestedTest -DprojectVersion=1.0-SNAPSHOT
package junit.NestedTest; import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @QuarkusTest public class GreetingResourceTest { @BeforeEach public void beforeEach() { System.out.println("beforeEach"); } @Test public void test() { System.out.println("test"); } @Nested class Nested1 { @BeforeEach public void beforeEach() { System.out.println("beforeEach1"); } @Test public void test() { System.out.println("test1"); } @Nested class Nested2 { @BeforeEach public void beforeEach() { System.out.println("beforeEach2"); } @Test public void test() { System.out.println("test2"); } } } }
mvn test
uname -a
ver
Microsoft Windows [Version 10.0.18363.1500]
java -version
java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) Client VM (build 25.201-b09, mixed mode)
1.13.7
mvnw --version
gradlew --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
quarkus/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
Line 949 in 645c35f
Reported also on stackoverflow: https://stackoverflow.com/questions/67932551/could-not-find-beforeeach-setup-method-on-nested-test-class-in-quarkustest/67986570#67986570
The text was updated successfully, but these errors were encountered:
Ensure @QuarkusTest works with @nested and test lifecycle methods
4a61283
Fixes: quarkusio#17975
Merge pull request #17997 from geoand/#17975
ab7a762
37d5f84
Fixes: quarkusio#17975 (cherry picked from commit 4a61283)
geoand
Successfully merging a pull request may close this issue.
Describe the bug
@Nested
classes are not working properly in@QuarkusTest
.Expected behavior
@Nested
tests run without throwing exceptionActual behavior
Exception is thrown:
java.lang.RuntimeException: Could not find method public void junit.NestedTest.GreetingResourceTest.beforeEach() on test class
To Reproduce
Steps to reproduce the behavior:
mvn io.quarkus:quarkus-maven-plugin:1.13.7.Final:create -DprojectGroupId="junit.NestedTest" -DprojectArtifactId=NestedTest -DprojectVersion=1.0-SNAPSHOT
mvn test
Environment (please complete the following information):
Output of
uname -a
orver
Microsoft Windows [Version 10.0.18363.1500]
Output of
java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) Client VM (build 25.201-b09, mixed mode)
GraalVM version (if different from Java)
Quarkus version or git rev
1.13.7
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Additional context
quarkus/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
Line 949 in 645c35f
This line skips the enclosing class of the nested class.
Reported also on stackoverflow:
https://stackoverflow.com/questions/67932551/could-not-find-beforeeach-setup-method-on-nested-test-class-in-quarkustest/67986570#67986570
The text was updated successfully, but these errors were encountered: