Friday 20 June 2014

Gherkin Language and BDD

Gherkin Language


Point:
A feature or user story is comprised of 1 or more scenarios.

Point:

Each Scenario is defined by GIVEN WHEN THEN sections as explained below:
  • GIVEN is about
    • Preconditions
    • Setups
    • Arrangements
    • Preparations
    • All the parameters and preparations needed before the Action can be taken
    • Multiple steps can be combined with each other using AND or OR
    • Preparations such as GIVEN an existing user with name William enters William in the text box
  • WHEN is about
    • Action that is taken by the user to expect a certain behavior
    • Multiple steps can be combined with each other using AND or OR
    • Actions such as Clicking on a Button, Entering a Number, Navigating to a Page

    • THEN is about
      • Expected behaviour
      • How the behavior can be verified
      • Multiple steps can be combined with each other using AND or OR

      Point:

      Each edge case of a feature should be considered as a separate scenario.


      Examples

      GIVEN user goes to www.google.com 
        AND enter "Technology" in the search box
      WHEN the search button is clicked
      THEN a list of latest adverts related to "Technology" should be shown to the use