O'Reilly logo

Learning Behavior-driven Development with JavaScript by Enrique Amodeo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required