Junit 黄瓜报告以“When”而不是“Given”开头

Junit 黄瓜报告以“When”而不是“Given”开头,junit,cucumber,bdd,cucumber-jvm,cucumber-junit,Junit,Cucumber,Bdd,Cucumber Jvm,Cucumber Junit,使用此JUnit runner运行测试时: @RunWith(Cucumber.class) @CucumberOptions ( features = "C:\\myfeature.feature", glue = {"stepmethods"}, plugin = {pretty}, junit = "--step-notifications", dryRun = false ) public class Ru

使用此JUnit runner运行测试时:

@RunWith(Cucumber.class)
@CucumberOptions (
        features = "C:\\myfeature.feature",
        glue = {"stepmethods"},
        plugin = {pretty},
        junit = "--step-notifications",
        dryRun = false
)

public class RunTest {

}
并具有标准要素文件

**Given** I'm on the homepage
**When** I enter the correct credentials
**And** I click submit
**Then** I will get a userlist
当我运行这个控制台时,日志显示测试以when关键字开始。我之所以知道这一点,是因为我偶尔会打印一些检查点来控制它们

如果我注释掉了When和steps,那么就得到了正确的输出

可能是什么问题

更新:

测试以正确的顺序运行,但它们不会以相同的顺序记录到控制台。 这似乎与plugin={pretty}选项有关。当它被排除在外时,日志记录似乎很好


我仍然想保留这个选项。有解决办法吗?

试着在双引号和添加报告类型之间加上pretty

@CucumberOptions (
    features = "C:\\myfeature.feature",
    glue = {"stepmethods"},
    plugin = {"pretty", "html:some/dir"},
    junit = "--step-notifications",
    dryRun = false
)

你必须给下面的方式也工作

@CucumberOptions 
(
features = "C:\\myfeature.feature",

glue = {"stepmethods"},

plugin = {"pretty", "html:some/dir"},

stepNotifications=true,

dryRun = false

)

您的问题是关于步骤的运行还是步骤的报告?是关于报告。步骤按正确的顺序运行。是的,我从更新中计算出来。也许你可以重新表述你的问题?此外,这也是预期的行为;步骤不保证按顺序报告。我编辑了标题。这可能是预期的行为,但为什么不按正确的顺序报告步骤。嗯,现在我想起来了,这可能只是在并行运行时。我不确定tbh。请在主页上发布给定的步骤定义。虽然这不重要,因为cucumber可以逃过字符,但也可以尝试删除单引号。如果您可以提供一个示例,那么我们可以在我们的机器上复制该行为。这在任何情况下都是打开错误报告所必需的。