More-Advanced Cucumber
This section should be titled “Things Cucumber lets you do that are bad ideas.” Cucumber allows for a lot of flexibility in the way steps match with step definitions. By and large, the Cucumber-using community has come to the conclusion that most of these things should be used sparingly, if at all.
Earlier I alluded to the idea that step definitions were regular expressions and not strings. This allows you to have the same step definition apply to multiple strings. More to the point, you can use regular-expression groups to capture those matches. The parts of the string that are in groups are then passed as block variables to the block part of the step definition. This allows you to use a Cucumber step as a method call ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access