Search code examples
cucumbercitrus-framework

Citrus cucumber does not provide default implementation for sleep


I'm using the citrus framework (2.7.6, also tested with 2.8.0-SNAPSHOT) to end-to-end test an application. While creating a test I noticed the documentation has a default sleep and echo method as described in the docu on 33.9 and 33.10 (https://citrusframework.org/citrus/reference/2.7.5/html/index.html#sleep-steps). However the following feature file complains about not providing an implementation:

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

results in:

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();
}

any hints where I should be looking for a solution?

Steps I've written are running fine, just the defaults seem to be missing.


Solution

  • Sounds like you did not add the default Citrus step implementation package as glue to your @CucumberOptions annotation. You need to add the following to your test class:

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

    This package contains the default step implementation for "echo" and "sleep".