spockframework / spockframework/spock

EmbeddedSpecRunner.runWithImports() throws MissingMethodException

Open
#1,148 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

3rd-party: junit-platform enhancement
Dominant language
Java
Stars
3.6k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with spock-core/src/main/groovy/spock/util/EmbeddedSpecRunner.groovy and inspect the runWithImports() signature and its EngineExecutionResults reference. Check how junit-platform-testkit is declared as an optional dependency, then verify that EmbeddedSpecRunner.runWithImports() can be called with a String without the MissingMethodException.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.