黄瓜 - 在 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>
使用构建工具中的依赖项更新您的问题,我们也许可以为您提供更多帮助。
我有以下黄瓜功能,但没有任何相应的 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>
使用构建工具中的依赖项更新您的问题,我们也许可以为您提供更多帮助。