Book Image

Learning Behavior-driven development with Javascript

Book Image

Learning Behavior-driven development with Javascript

Overview of this book

Table of Contents (17 chapters)
Learning Behavior-driven Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 be possible to "place order"
    And there will be possible to "add beverage"
    And there will be possible to "place order"
    And there will be possible to "edit item quantity" for item "1"
    And there...