柑橘黄瓜不提供睡眠的默认实现

Citrus cucumber does not provide default implementation for sleep

我正在使用柑橘框架(2.7.6,也使用 2.8.0-SNAPSHOT 进行测试)来端到端测试应用程序。在创建测试时,我注意到文档有一个默认的睡眠和回声方法,如文档 33.9 和 33.10 (https://citrusframework.org/citrus/reference/2.7.5/html/index.html#sleep-steps) 中所述。但是,以下功能文件抱怨未提供实现:

Feature: Test
  Scenario: Sleep test
    Given echo "hi"
    Then sleep 50 ms

结果:

You can implement missing steps with the snippets below:
@Then("sleep {int} ms")
public void sleep_ms(Integer int1) {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Given("echo {string}")
public void echo(String string) {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

我应该在哪里寻找解决方案的任何提示?

我写的步骤 运行 很好,只是似乎缺少默认值。

听起来您没有将默认的 Citrus 步骤实施包添加到您的@CucumberOptions 注释中。您需要将以下内容添加到测试中 class:

@CucumberOptions(glue = { "com.consol.citrus.cucumber.step.runner.core" })

此包包含 "echo" 和 "sleep" 的默认步骤实现。