Nesting Steps

Finding the right level of detail, or abstraction, to use in your scenarios is a skill that takes some time to master. What many people don’t realize is that different levels of detail are appropriate for different scenarios in the same system—sometimes in the same feature—depending on what it is they’re describing.

As an example, here’s a scenario for the user of our ATM authenticating with their PIN:

 Scenario​: Successful login with PIN
  Given I have pushed my card in the slot
  When I enter my PIN
  And I press ​"OK"
  Then I should see the main menu

It’s entirely appropriate for us to go into this much detail about the authentication process in this scenario, because that’s where our focus is. Now consider our cash ...

Get The Cucumber Book, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.