我有以下黄瓜功能,没有任何相应的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();
}
任何人都可以帮助我如何实现这一目标吗?
答案 0 :(得分:1)
您正在获取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>
使用构建工具中的依赖项更新您的问题,我们可以为您提供更多帮助。