Writing advanced scenarios

At this point, we have the first scenario working and, thanks to our sugar utility, we have better error reporting and less clutter in our test code. Now, we will try to address the upcoming scenarios that are a bit more complicated.

Gherkin example tables

We could write the following Gherkin code for the scenario about nonempty orders:

Feature: Customer displays order // Skipped for brevity Scenario: Order is empty // Skipped for brevity Scenario: Non empty order Given that the order contains "1" "Expresso" And that the order contains "2" "Mocaccino" When the customer displays the order Then the order will show "1" "Expresso" And the order will show "2" "Mocaccino" And "6.10" will be shown as total price And there will ...

Get Learning Behavior-driven Development with JavaScript 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.