繁体   English   中英

黄瓜-在Java中实现缺少的步骤

[英]Cucumber - implementing missing steps in java

我具有以下黄瓜功能,而没有任何相应的Java代码操作。

@CucumberTest
Scenario: Testing cucumber
 Given I have this test.
 When I test This
 Then I get this

当我运行它时,我得到以下结果

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


    You can implement missing steps with the snippets below:

    Given("^I have this test\\.$", () -> {
        // Write code here that turns the phrase above into concrete actions
        throw new PendingException();
    });

    When("^I test This$", () -> {
        // Write code here that turns the phrase above into concrete actions
        throw new PendingException();
    });

    Then("^I get this$", () -> {
        // Write code here that turns the phrase above into concrete actions
        throw new PendingException();
    });

但是我希望缺少的步骤像下面这样在Java中出现:

    @Given("^I have this test\\.$")
    public void I_have_this_test() throws Throwable {
        // Write code here that turns the phrase above into concrete actions
        throw new PendingException();
    }

谁能帮助我实现这一目标?

您将获得Java 8的代码片段。请与我们分享您的依赖关系。

我假设您有一个依赖项(使用Maven样式依赖项)

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java8</artifactId>
    <version>1.2.4</version>
</dependency>

相反,我认为您想依靠

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.4</version>
</dependency>

使用您的构建工具中的依赖项来更新您的问题,我们也许可以为您提供更多帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM