Mastering pro tips for writing good steps (Advanced)
In this recipe, will cover various kinds of tips for writing good, maintainable, and DRY Cucumber steps.
We will reuse the Rails application
cucumber_bdd_how_to that we've created in the Writing your first Hello World feature (Simple) recipe, so please
cd into that directory to get prepared.
How to do it...
In the following sections, a number of useful step tips will be introduced and covered exhaustively.
- Let's imagine that we need to write a step that contains a singular or plural noun depending on its count:
When the user has 1 gift ... When the user has 5 gifts ...
- Instead of implementing two similar step definitions, we can adopt a tip in Cucumber called Flexible ...