Spock - No Tests Found Matching Method

When trying to run a newly created Spock test in IntelliJ this evening I was rudely presented with the error: “No tests found matching Method foo”.

Here was my test:

class MySpec extends Specification {

    def "foo"() {
        // do something
    }
}

Solution

I forgot I was using Spock and not JUnit, therefore it requires at least a when: and then: or expect: labels!

So now it looks like:

class MySpec extends Specification {

    def "foo"() {
        when:
        // do something
        then:
        // check something
    }
}