Skip to content

Generating step definitions with Cucumber 6 vs Cucumber 5 #2024

@NicolasLauwereys

Description

@NicolasLauwereys

Description

When executing unimplemented scenarios with Cucumber 5 and JUnit you get an uninterrupted list of all unimplemented steps at the end of the output, so you can copy-paste those directly into your steps definitions class and start implementing.

When using Cucumber 6 however, it seems the generated steps are only displayed with other output inbetween. There is no uninterrupted list at the end of the ouput.

We would like this feature to also be added to Cucumber 6.


Example output with Cucumber 5


You can implement missing steps with the snippets below:

@When("{string} provides all required personal details of a patient:")
public void provides_all_required_personal_details_of_a_patient(String string, io.cucumber.datatable.DataTable dataTable) {
    // Write code here that turns the phrase above into concrete actions
    // For automatic transformation, change DataTable to one of
    // E, List<E>, List<List<E>>, List<Map<K,V>>, Map<K,V> or
    // Map<K, List<V>>. E,K,V must be a String, Integer, Float,
    // Double, Byte, Short, Long, BigInteger or BigDecimal.
    //
    // For other transformations you can register a DataTableType.
    throw new io.cucumber.java.PendingException();
}

@When("she provides the full set of physical details:")
public void she_provides_the_full_set_of_physical_details(io.cucumber.datatable.DataTable dataTable) {
    // Write code here that turns the phrase above into concrete actions
    // For automatic transformation, change DataTable to one of
    // E, List<E>, List<List<E>>, List<Map<K,V>>, Map<K,V> or
    // Map<K, List<V>>. E,K,V must be a String, Integer, Float,
    // Double, Byte, Short, Long, BigInteger or BigDecimal.
    //
    // For other transformations you can register a DataTableType.
    throw new io.cucumber.java.PendingException();
}

@Then("all the details of the patient are added")
public void all_the_details_of_the_patient_are_added() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

@When("{string} provides incorrect details of a patient")
public void provides_incorrect_details_of_a_patient(String string) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

@Then("the new patient is not added")
public void the_new_patient_is_not_added() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

@Given("a patient is registered with social security number {string}")
public void a_patient_is_registered_with_social_security_number(String string) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

@When("{string} provides valid details of a patient with the same social security number")
public void provides_valid_details_of_a_patient_with_the_same_social_security_number(String string) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

@Then("an error is given explaining that {string}")
public void an_error_is_given_explaining_that(String string) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions