I'm trying to upgrade a Spring Boot (2.1.4.RELEASE) project from Spock 1.3 to 2.0. Unfortunately, I'm getting No tests found for given includes:
for any test I try to run. Here is a build.gradle
snippet with what I hope are all the relevant parts:
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
// enabling spock - the bdd
testImplementation(
"org.spockframework:spock-core",
"org.spockframework:spock-spring:${spockGroovyVersion}",
"org.codehaus.groovy:groovy:3.0.8",
"io.github.http-builder-ng:http-builder-ng-apache:1.0.4",
platform("org.spockframework:spock-bom:${spockGroovyVersion}")
)
// Provides JUnit, Spring Test, AssertJ, Hamcrest, Mockito, JSONassert, & JsonPath
testImplementation("org.springframework.boot:spring-boot-starter-test") {
// don't include JUnit 4 (needed until spring-boot-starter-test:2.2.0 is supported)
exclude group: 'junit', module: 'junit'
}
test {
useJUnitPlatform()
}
I get the same result whether useJUnitPlatform()
is present or commented out.
${spockGroovyVersion}
is exactly2.0-groovy-3.0
? BTW, you do needuseJUnitPlatform()
for Spock 2, please do not comment it out. An MCVE reproducing the problem on GitHub would be helpful. – Platinotypeplugins { id 'java'; id 'groovy' }
in your Gradle config? Without the Groovy plugin, no tests can be found. – PlatinotypesourceCompatibility = '11'
, but running the build on an older JDK like 8. I just updated my answer here. If that solves your problem, please let me know. – Platinotype2.0-groovy-3.0
. I am unfortunately unable to provide an MCVE as this is a work project, and it could well take longer to disentangle unrelated code than to stumble upon a fix without an MCVE. With respect to plugins, I haveapply plugin: 'groovy'
, no Java plugin. The only Java version line I see isjavaConfig.targetVersion = JavaVersion.VERSION_1_8
– Fant