java - 在日志上看不到黄瓜片段
问题描述
我刚刚启动了一个 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。
当我启动验收测试时,我会看到日志中未定义步骤。但没有出现任何片段
所有验收测试
@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();
}
解决方案
如果您通过 JUnit 而不是 CLI 或 IDEA 运行,则必须summary
显式添加插件。
@CucumberOptions(plugin = {"summary", "pretty", "html:FeaturesReport"},
推荐阅读
- amazon-web-services - 使用 Apache Airflow 编辑存储在 AWS S3 中的 CSV,无需下载
- protractor - 角度测试 - 将 Jest 与量角器一起使用
- angular - 模态控制器在离子科尔多瓦中不起作用
- sql-server - 如何在 AVG() 函数 SQL Server 中表示 0.5 或 1/2
- visual-studio-code - VSCode 一些快捷键不能正常工作
- rust - 调用返回字符串字面量数组的函数,出现“无法返回引用局部变量的值”错误
- python - 收到导入 scipy.signal 的错误
- php - 如何使用 PHP/SQL 在 Azure SQL 表中选择包含“#”的行?
- mysql - 无法在 xampp 中启动 mysql
- reactjs - React.JS,TypeError:this.state.movies.map 不是函数问题