spock icon indicating copy to clipboard operation
spock copied to clipboard

EmbeddedSpecRunner.runWithImports() throws MissingMethodException

Open henrik242 opened this issue 5 years ago • 0 comments

Using EmbeddedSpecRunner.runWithImports() throws groovy.lang.MissingMethodException: No signature of method: spock.util.EmbeddedSpecRunner.runWithImports() is applicable for argument types: (String) values: ...

Locating the reason was difficult, but new EmbeddedSpecRunner().class.declaredMethods reveals the culprit: java.lang.NoClassDefFoundError: org/junit/platform/testkit/engine/EngineExecutionResults

The reason is that junit-platform-testkit needs to be explicitly depended on. This is now an optional dependency.

A workaround might be to replace EngineExecutionResults with def in spock-core/src/main/groovy/spock/util/EmbeddedSpecRunner.groovy

More info in https://github.com/spockframework/spock/issues/1073#issuecomment-617009915

henrik242 avatar Apr 21 '20 09:04 henrik242