Cucumber expression
A Cucumber expression is a pattern syntax for matching step text and converting parameter placeholders into values for step definitions.
BDD in Action, Second Edition
A Cucumber expression is a pattern notation for matching Gherkin steps and converting captured text into parameters for step definitions.
- How it is used
- Binds readable Gherkin steps to reusable automation methods while passing scenario data into those methods.
- How deep it goes
- Works through typed captures, anonymous conversion, optional text, and word alternatives; reserves more sophisticated matching for regular expressions.
- Examples
- Uses train timetable steps and Frequent Flyer membership statuses to show captured data and reusable definitions.
- What you can do after
- Apply it via Cucumber to match scenario steps, pass captured values to step definitions, and reduce duplicated automation code.
Read how BDD in Action, Second Edition explains cucumber expression →
Effective Behavior-Driven Development
A Cucumber pattern syntax for matching Gherkin step text to a step definition and extracting parameter values.
- How it is used
- Matches Gherkin step text to step definitions and passes captured test data as arguments for scenario automation.
- 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.
Read how Effective Behavior-Driven Development explains cucumber expression →
What to know first
- regular expressionA regular expression is a formal pattern notation that describes sets of strings and specifies how text can be matched, searched, or transformed.
Related concepts
- parameter typeuses · A user-defined parameter type that matches text in a step and converts it into a value for step-handling code.
- regular expressionalternative to · A regular expression is a formal pattern notation that describes sets of strings and specifies how text can be matched, searched, or transformed.
Questions about cucumber expression
What is cucumber expression?
A Cucumber expression is a pattern syntax for matching step text and converting parameter placeholders into values for step definitions.
Which Manning books explain cucumber expression?
BDD in Action, Second Edition and Effective Behavior-Driven Development.
What should I know before learning cucumber expression?
Manning books that teach cucumber expression usually introduce regular expression first.
What is the difference between cucumber expression and regular expression?
A Cucumber expression is a pattern syntax for matching step text and converting parameter placeholders into values for step definitions. A regular expression is a formal pattern notation that describes sets of strings and specifies how text can be matched, searched, or transformed.
What are the parts of cucumber expression?
Cucumber expression includes parameter placeholder.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

