【发布时间】:2019-12-15 19:27:53
【问题描述】:
我刚刚启动了一个 2.1.6 版的 sping-boot 项目(使用启动器:spring-boot-starter-web、spring-boot-starter-test)
我正在尝试在 4.7.1 版中使用 cucumber for java,并带有以下 maven 依赖项:cucumber-spring、cucumber-junit、cucumber-java8。
当我启动验收测试时,我会在日志中看到未定义步骤。但是没有出现sn-ps
AllAcceptanceTests
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty", "html:FeaturesReport"},
features = {"src/test/resources/features"},
snippets = CucumberOptions.SnippetType.UNDERSCORE)
public class AllAcceptanceTests {
}
我的场景
Scenario: Creation from initialisation
Given name "Jean"
Given gender "Male"
Given picture "picture.png"
Given account identifier 1
When try to create the profile with these parameters
Then the profile id = 1 , name = "Jean" , gender = "Male" and picture = "picture.png" is saved
Junit 日志
Scenario: Creation from initialisation # src/test/resources/features/create-profile.feature:9
Given name "Jean" # ProfileSteps.java:23
Given gender "Male" # ProfileSteps.java:27
Given picture "picture.png" # ProfileSteps.java:31
Given account identifier 1 # null
When try to create the profile with these parameters # ProfileSteps.java:37
Then the profile id = 1 , name = "Jean" , gender = "Male" and picture = "picture.png" is saved # ProfileSteps.java:46
io.cucumber.junit.UndefinedThrowable: The step "existing account in nisfee-account :" is undefined
我正在使用所有 spring-boot 默认配置。我是不是因为在我的日志中有这样的东西而忘记了什么:
You can implement missing steps with the snippets below:
@Given("^today is Sunday$")
public void today_is_Sunday() {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
【问题讨论】:
标签: java spring spring-boot junit cucumber