简体   繁体   中英

IntelliJ cannot find Step Definitions from Feature File

I've setup the following cucumber skeleton project using the repo from Cucumber: https://github.com/cucumber/cucumber-java-skeleton

I'm using IntelliJ 2019.1.3 with the latest bundled Cucumber for Java and Gherkin plugins

I'm using Java: openjdk version "1.8.0_232"

I'm have a local Gradle install of 6.0.1 and for the project, gradlew 6.7.1

I have the following cucumber dependencies specified:

  testImplementation 'io.cucumber:cucumber-java:6.9.1'
  testImplementation 'io.cucumber:cucumber-junit:6.9.1'

When I run using the command line:

./gradlew test --rerun-tasks --info

...the tests can be run from the RunCucumberTest JUnit runner, but I cannot configure the bundled Cucumber and Gherkin plugins to 'see' the Steps from the Feature File as they all remain grayed out:

在此处输入图像描述

Given I'm using Cucumber's own vanilla project, what can I try to resolve the issue of the Feature File failing to recognised or run the steps?

Well as the error you are getting says:

io.cucumber.skeleton.RunCucumberTest > Belly.a few cukes FAILED io.cucumber.junit.UndefinedStepException: The step "I wait 1 hour" is >undefined. You can implement it using the snippet(s) below:

So add the following snippet into StepDefinitions.java file:

@When("I wait {int} hour")
public void i_wait_hour(Integer int1) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM