RunnerClass没有找到步骤?

时间:2017-05-07 18:30:28

标签: java selenium junit cucumber

为什么我的跑步者课程没有找到我的步骤文件?

我创建了两个具有独特方法的特征文件等,如果我逐个执行它们,它们能够找到相关的步骤,但dosnt在执行主流道类时有效吗?

@RunWith(Cucumber.class)

@CucumberOptions (
        features = {"src/test/java/CucumberFramework/featureFiles/"},
        glue = {"src/test/java/CucumberFramework/steps"},
        monochrome = true,
        tags = {},
        plugin = {"pretty", "html:target/cucumber", "json:target/cucumber.json", "com.cucumber.listener.ExtentCucumberFormatter:target/report.html"}
        )

public class MainRunner {

}

enter image description here

1 个答案:

答案 0 :(得分:3)

我相信glue采用包名,而不是路径。所以你想要:

@CucumberOptions (
        features = {"src/test/java/CucumberFramework/featureFiles/"},
        glue = {"CucumberFramework.steps"}, // < I changed this
        monochrome = true,
        tags = {},
        plugin = {"pretty", "html:target/cucumber", "json:target/cucumber.json", "com.cucumber.listener.ExtentCucumberFormatter:target/report.html"}
        )