场景步骤(给定,何时,然后)未显示在IntelliJ控制台(Cucumber-Java with Junit)中



当我在本地运行测试时,我在 IntelliJ 控制台中看不到功能方案步骤。通常你会看到每个场景的所有给定,何时和,然后步骤。

我确实在IntelliJ中安装了Cucumber-Java插件。和智能创意版本 - 智能 终极版 2020.1 我的黄瓜,junit和java版本在pom:


<java.version>1.8</java.version>
<junit.version>4.13</junit.version>
<cucumber.version>5.6.0</cucumber.version>

跑步者测试


package io.cucumber.hellocucumber;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty"})
public class RunCucumberTest1 {
}

功能文件


Feature: Is it Friday yet?
Everybody wants to know when it's Friday
Scenario: Sunday isn't Friday
Given today is Sunday
When I ask whether it's Friday yet
Then I should be told "No"
Scenario: Friday is Friday
Given today is Friday
When I ask whether it's Friday yet
Then I should be told "TGIF"   

测试结果/输出

sampling ...
include patterns:
io.cucumber.core.cli..*
exclude patterns:
Jun 04, 2020 11:31:23 AM io.cucumber.core.cli.Main run
WARNING: By default Cucumber is running in --non-strict mode.
This default will change to --strict and --non-strict will be removed.
You can use --strict to suppress this warning
1 Scenarios (1 passed)
3 Steps (3 passed)
0m0.583s
Class transformation time: 0.0138887s for 1552 classes or 8.948904639175257E-6s per class
Process finished with exit code 0

任何帮助,不胜感激。

谢谢 尼迪

看起来你正在使用IDEA来运行你的Cucumber测试,而不是JUnit(RunCucumberTest1类(。

当您使用 IDEA 时,测试的输出会自动分组为多个部分。如果展开测试结果树(可能需要切换某些筛选器(,则可以单击某个步骤并查看其执行期间输出的内容。

如果您想查看打印的步骤信息,则必须明确启用漂亮的打印机。您可以通过向运行配置菜单中的 CLI 参数添加--plugin pretty来执行此操作。如果将其添加到模板中,则只需执行此操作一次(请先删除所有旧的黄瓜运行配置(。

最新更新