Undefined step reference - Java8 Lambda - Kotlin
See original GitHub issueJava - 8 Kotlin - 1.3 Cucumber - 4.1.1 IntelliJ - 2018.2.5 Cucumber for Java Plugin - 182.3934 Windows 10 64
Example Class:
import cucumber.api.java8.En
import org.testng.Assert
class ThenSteps(private val contextHolder: contextHolder) : En {
private lateinit var Response response;
init {
BeforeStep { scenario ->
contextHolder.getResponse()?.let {
response = it
}
}
Then("^I receive a response status code of (\\d+)$") { statusCode: Int ->
Assert.assertEquals(response.statusCode(), statusCode)
}
}
}
In my feature file all of my steps are underlined with “Undefined step reference: …”
If I right click and run feature in IntelliJ, but manually point the glue to my steps classes, I then get these errors:
java.lang.NoSuchMethodError: io.cucumber.stepexpression.ArgumentMatcher.argumentsFrom(Lgherkin/pickles/PickleStep;)Ljava/util/List; at cucumber.runtime.java8.Java8StepDefinition.matchedArguments(Java8StepDefinition.java:93) at cucumber.runner.Glue.stepDefinitionMatches(Glue.java:104) at cucumber.runner.Glue.stepDefinitionMatch(Glue.java:82) at cucumber.runner.Runner.addTestStepsForPickleSteps(Runner.java:64) at cucumber.runner.Runner.createTestCaseForPickle(Runner.java:54) at cucumber.runner.Runner.runPickle(Runner.java:39) at cucumber.runtime.Runtime$1.run(Runtime.java:84) at cucumber.runtime.Runtime$SameThreadExecutorService.execute(Runtime.java:220) at cucumber.runtime.Runtime.run(Runtime.java:81) at cucumber.api.cli.Main.run(Main.java:26) at cucumber.api.cli.Main.main(Main.java:8) at ✽.I receive a home aggregator decline code of 2(C:/git/qa-api/src/main/resources/features/Feature.feature:10)
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Sorry @mpkorstanje - It was Maven. It had downloaded a corrupted 4.2.0 and so half the classes weren’t resolving. I’ve cleared my local maven, redownloaded and it’s all good now. Thanks and sorry!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.