I'm facing an issue I cannot solve. I have following code structure in my application:
src
- main
- java
- test
- java
- groovy
It's rather conventional. Some tests are written in java using JUnit5 and some are written in groovy using Spock.
When I run gradlew test only tests in /src/test/groovy are run. There are no errors. Java test are simply not being run. I added on purpose failing test to /src/test/java to check whether there's an issue with printing reports. The test is not failed, because whole package /src/test/java is ignored somehow.
I tried to find solution on SO but none of the answeres helped me.
I messed around with ideas like:
sourceSets {
test {
java { srcDirs = "src/test/java" }
groovy { srcDirs = "src/test/groovy" }
}
}
That didnt help. Here are some snippets from my build.gradle
Plugin:
apply plugin: 'groovy'
Test dependencies:
testImplementation("org.springframework.boot:spring-boot-starter-test:2.1.4.RELEASE") {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation("org.junit.jupiter:junit-jupiter:5.5.2")
testImplementation(group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5')
testImplementation(group: 'org.spockframework', name: 'spock-spring', version: '1.3-groovy-2.5')
testImplementation(group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.3-groovy-2.5', ext: 'pom')
Test task configuration:
test {
useJUnit()
failFast = true
testLogging.showStandardStreams = true
reports {
junitXml.enabled = true
}
finalizedBy jacocoTestReport
finalizedBy jacocoTestCoverageVerification
finalizedBy check
testLogging {
events "PASSED", "STARTED", "FAILED", "SKIPPED"
}
}
Do you have any ideas?