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
The combination of JUnit 5.3.0, maven-surefire-plugin 2.22.0 and reuseForks=false fails to find tests #1579
Comments
As the entire code now resides in Surefire's repo, please open new Surefire-related issues here: https://issues.apache.org/jira/browse/SUREFIRE Seems to be related to apache/maven-surefire#193 -- see also the discussion at https://mail-archives.apache.org/mod_mbox/maven-dev/201809.mbox/browser "issue with junit 5 integration". I'm not sure, what a possible solution could be. The PR 193 seems to fix the issue. |
I opened https://issues.apache.org/jira/browse/SUREFIRE-1566 according to this comment. |
|
Thanks, Allon.
We do. ;-) |
|
Any news on this? Does the latest 5.3.1 update fix this issue? Unfortunately there doesn't seem to be any activity on the Maven Surefire issue. |
|
@winterbe I've tested with JUnit 5.3.1 too, and it does not fix the issue. |
|
I have experienced a similar issue but using Gradle 4.9 and 4.10 junit platform integration with Junit 5.3.0 and 5.3.1. Everything works with 5.2.0. |
|
It is a bug in how Surefire resolves the underlying JUnit Platform dependencies. At the moment, it always loads version For details see https://issues.apache.org/jira/browse/SUREFIRE-1564 |
|
@sormuras would this fix the issue with Gradle as well? |
|
No, don't think so. Gradle has it's own integration of the platform. Correct, @marcphilipp? |
|
In any case the fix required in Surefire might be required in Gradle. |
|
Gradle seems not affected. The generated ...configured via: Running with application classpathimplementation classpath |
|
After trying a number of my Gradle projects, it appears to only effect my Spring Boot projects. I need to look more deeply. Any insights would be appreciated. |
|
Then that's almost certainly due to a version conflict.
|
|
Sounds like a recent thread on Twitter I participated in. See the history of this person's https://github.com/TimRiemer/junit5_springboot_test/commits/master/build.gradle |
|
Basically, you need the following: ext['junit-jupiter.version'] = '5.3.1' // or '5.3.0'
test {
useJUnitPlatform()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter')
testCompile('org.junit.jupiter:junit-jupiter-api')
testRuntime('org.junit.jupiter:junit-jupiter-engine')
testCompile('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'junit', module: 'junit'
}
}Of course, you don't have to exclude JUnit 4 if you are using it, but then you'll need the |
|
@sbrannen that did it. I did not consider this because it is the first time I have encountered anomalous behavior. Going forward I will use the property to set the version and let the Spring Boot plugin do the rest. Thanks to all for their help! |
|
Glad to hear that works for you! |
Quick note: Kudos! |
|
I was also facing the same issue (using spring-boot). |
…versions and surefire version 2.22.0 causes no tests to run * ref - junit-team/junit5#1579
…versions and surefire version 2.22.0 causes no tests to run * ref - junit-team/junit5#1579
|
For anyone seeking a more clear Maven-oriented answer, find where in your pom.xml spring-boot-starter-test or spring-boot-starter is declared and add an exclusion for junit-jupiter, then specify your own version (the latest, 5.9.0 seemed to work for me): |
|
The adding junit-jupiter:5.9.0 did not work for me. I had to downgrade maven-surefire-plugin from 2.22.2 to 2.21.0 |
Overview
I'm not sure if this bug should be reported here or on maven-surefire-plugin's repo, but I'll give it a try here.
When using a combination of JUnit 5.3.0 together with maven-surefire-plugin 2.22.0 configured with reuseForks=false, surefire fails to find any JUnit tests.
Downgrading JUnit to 5.2.0 makes it work (i.e., tests are properly found), as does setting reuseForks=true.
The
pom.xmlfile:A complete example (just unzip and run
mvn install):reuser-forks.zip
With JUnit 5.3.0, you'll see the output:
With JUnit 5.2.0, you'll see the expected output:
The text was updated successfully, but these errors were encountered: