

Recall that step definitions start with a preposition or an adverb ( Given, When, Then, And, But).Īll step definitions are loaded (and defined) before Cucumber starts to execute the plain text in the feature file.

Note: For now, Cucumber Scala does not support using Scala collection types. Is to use a data table: Given the following animals:ĭeclare the argument as a List List list of strings list of strings, but don’t define any capture group capture group capture group output parameter output parameter The simplest way to pass a List List list of strings list of strings to a step definition Depending on the table shape as one of the following collections: Depending on the table shape as one of the following collections: List> table This conversion can be done either by Cucumber or manually. Data Tablesĭata tables from Gherkin can be accessed by using the DataTable object as the last parameter in a step definition. (If there is a mismatch, Cucumber will throw an error). The number of parameters in the method function block function function has to match the number of capture group capture group capture group output parameter output parameter In the example given in step definitions, Cucumber extracts the text 48 from the step, converts it to an intĪnd passes it as an argument to the method function block function function.

Cucumber can be used to implement automated tests based on scenarios described in your Gherkin feature files.
