简体   繁体   中英

Cucumber undefined step reference in Intellij

I have problem with Intellij 2019.2.4 Ultimate where I am unable to navigate from Cucumber feature file to glue code. Intellj is complaining of "Undefined Step Reference". Executing the cucumber test from console or via run configuration is however successfull.

Cucumber version 5.5.0 Junit version 4.13

Based on similary reported issues, this is what I have tried so far:

  • Verified that both Cucumber for Java and Gherkin plugins are enabled
  • Invalidate cache and restarted IDEA
  • Verified that SubSteps plugin is not enabled and in conflict with Cucumber for Java plugin
  • Reenable Cucumber for Java plugin

To illustrate my problem I have generated a simple project:

src/test/java/hellocucumber

package hellocucumber;

import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {"pretty", "html:target/cucumber"},
        features = {"src/test/resources/hellocucumber"},
        glue={"hellocucumber"},
        monochrome = true
)
public class RunCucumberTest {
}

my glue code

package hellocucumber;

import io.cucumber.java.en.Given;

public class StepDefinitions {

    @Given("today is Monday")
    public void today_is_Monday() {
        System.out.println("Today is monday");
    }
}

and my feature file: src/test/resources/hellocucumber/test.feature

Feature: This is a test

  Scenario: Today is or is not Friday
    Given today is Monday

Intellij complain of missing glue code:

在此处输入图片说明

I am lost and would much appreciate some input. Thanks

EDIT: Uploaded project OneDrive

Also note, if I downgrade cucumber version from 5.5.0 to pre 5.xx (eg 4.8.1) I am able to navigate from feature to glue!

This project works fine in IntelliJ IDEA 2019.3.3, please consider updating if you are using the recent Cucumber version.

2019.3.3

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