No tests found for given includes (IntelliJ & Groovy)

Viewed 1275

I am attempting to run unit tests written in Groovy, using IntelliJ and ./gradlew command. Building the project works fine, however the tests do not seem to be found. Running the tests in IntelliJ throws the following code:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [path.to.SomeTestClass](filter.includeTestsMatching)

No tests in my project are found, below is an example class I created in the project under src -> main -> test -> groovy directory.

import spock.lang.Specification

class SomeTestClass extends Specification {

    def "A test that should work"() {

        given:
        def someNumber = 1

        when:
        def anotherNumber = someNumber + 1

        then:
        anotherNumber == 2
    }
}

Would appreciate any help!

1 Answers

Solution:

This was solved by adding the following lines to build.gradle:

test {
    useJUnitPlatform()
}
Related