Intellij 中的 Cucumber 未定义步骤参考

Cucumber undefined step reference in Intellij

我在使用 Intellij 2019.2.4 Ultimate 时遇到问题,我无法从 Cucumber 功能文件导航到粘合代码。 Intellj 抱怨 "Undefined Step Reference"。然而,从控制台或通过 运行 配置执行黄瓜测试是成功的。

黄瓜版本 5.5.0 Junit 版本 4.13

基于类似报告的问题,这是我目前尝试过的方法:

为了说明我的问题,我生成了一个简单的项目:

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 {
}

我的胶水代码

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");
    }
}

和我的功能文件: src/test/resources/hellocucumber/test.特征

Feature: This is a test

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

Intellij 抱怨缺少胶水代码:

我迷路了,非常感谢您提供一些意见。谢谢

编辑: 上传的项目OneDrive

另请注意,如果我将 Cucumber 版本从 5.5.0 降级到 5.x.x 之前的版本(例如 4.8.1),我可以从功能导航到胶水!

该项目在IntelliJ IDEA 2019.3.3中运行良好,如果您使用的是最新的Cucumber版本,请考虑updating