Can't run individual Spock tests in IntelliJ IDEA 2021.2 ("No runnable methods")

I just upgraded to IDEA 2021.2 from 2021.1 and lost the ability to run individual Spock tests from the IDE. I can run all tests in the source folder, but when attempting to run an individual test using the gutter icon in the source editor or from the right-click menu in the project window I get errors like this:

org.junit.runners.model.InvalidTestClassError: Invalid test class 'HelloSpockSpec':
1. No runnable methods

at org.junit.runners.ParentRunner.validate(ParentRunner.java:525)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:102)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:84)
at org.junit.runners.JUnit4.<init>(JUnit4.java:23)
at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

This is with Spockframework 2.0-groovy-3.0, which has Junit 5 runner under the hood.

Official example project where this happens (and didn't use to with the previous version): https://github.com/spockframework/spock-example

Will try to downgrade to the previous IDEA version.

6
2 comments

I have the same exact thing happening right after upgrade to 2021.2. Can't run any test. Very frustrating.

0

Please sign in to leave a comment.