liveBook · Manning

Cucumber expression

As explained in Effective Behavior-Driven Development

A Cucumber pattern syntax for matching Gherkin step text to a step definition and extracting parameter values.

A Cucumber expression matches Gherkin step text to a step definition. It can repeat the step text exactly or use parameter placeholders to capture test data as ordered arguments. Built-in types include {string}, {int}, {float}, and {word}; custom types can also be defined. section 12.3.3

Reusing a pizza-order step

The expression “the customer orders a {string} pizza” matches steps ordering a 'Margherita' or a "BBQ" pizza, passing the pizza name to the step definition. Using {word} instead allows an unquoted name such as Margherita, but only as a single word. section 12.3.3

How Effective Behavior-Driven Development covers it

How deep it goes
Defines exact-text matching, ordered parameter extraction, built-in types, and custom types, while deferring custom-type details.
Examples
Uses customer authentication and pizza orders with quoted strings or unquoted single-word values.
What you can do after
Apply it to reuse step definitions across similar steps by capturing changing test data as ordered arguments.
How it connects
Connects Gherkin steps with step definitions, scenario automation, regular expressions, and behavior-driven development.

Also explained in

Compare how 2 books explain cucumber expression →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Behavior-Driven Development. The section links point to the parts of the book it draws on.