【问题标题】:Cucumber Runner class not workingCucumber Runner 课程不起作用
【发布时间】:2015-07-12 10:00:42
【问题描述】:

您好,我创建了一个功能文件,为此还创建了一个步骤定义类文件,但是当我尝试从 Cucumber runner 类运行功能时,每次它都会告诉:

您可以使用下面的 sn-ps 实现缺少的步骤:

我正在使用 Junit 运行该文件。

我的 Cucumber Runner 类如下:

    @RunWith(Cucumber.class)
    @CucumberOptions(
    features={"Features"},
    glue={"src.stepdefinition"},
    monochrome=false
            )

【问题讨论】:

  • 为什么不把功能文件的路径放在那里,而不是只放“功能”。

标签: cucumber


【解决方案1】:

一旦你运行了你的@RunWith(Cucumber.class)注解类,你必须使用cucumber提供的代码sn-p来完成场景测试类。

例如,如果您有一个名为 Eat Cucumber 的场景,如下所示:

Scenario: Eat cucumber
  Given I have a cucumber

在你的黄瓜测试类运行之后,你应该能够使用其输出提供的 sn-p 创建以下类:

public class EatCucumberSteps {
    @Given("^I have a cucumber$")
    public void I_have_a_cucumber() throws Throwable {
        // your implementation code here...
        throw new PendingException();
    }
    // add all your other missing steps
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-13
    • 1970-01-01
    • 2013-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-27
    • 2017-04-16
    相关资源
    最近更新 更多