黄瓜JVM找不到定义的步骤

时间:2016-02-09 19:14:40

标签: intellij-idea cucumber cucumber-jvm

当我跑步运行此测试时,它会抱怨它无法找到步骤。我尝试用Java 8样式和Java 7样式定义它们,并使用IntelliJ生成MyStepdefs类的步骤,但它找不到它们。

我使用的是版本1.2.4的cucumber-java8和cucumber-junit。

import cucumber.api.CucumberOptions;
import cucumber.api.DataTable;
import cucumber.api.PendingException;
import cucumber.api.java8.En;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
        monochrome = true,
        glue = {"com.mycom.core.agg.RunCukesTest"})
public class RunCukesTest implements En {

    public RunCukesTest() {
        Given("^I have PriceLevels$", (DataTable arg1) -> {
        });

        And("^I have a TradeRequest$", (DataTable arg1) -> {
        });

        Then("^I should get these LegRequests$", (DataTable arg1) -> {
        });
    }
}

运行测试打印

Running com.mycom.core.agg.RunCukesTest

1 Scenarios (1 undefined)
3 Steps (3 undefined)
0m0.000s


You can implement missing steps with the snippets below:

Given("^I have PriceLevels$", (DataTable arg1) -> {
.. rest deleted ...

从IntelliJ运行功能文件会产生相同的错误。

1 个答案:

答案 0 :(得分:1)

虽然我们无法弄清楚原因是什么,但创建一个具有最少依赖性的新maven项目“修复”了问题。我们不需要更改代码。

相关问题