BDD frameworks

BDD is an emerging software development model used along with agile methodologies. Some of the key things to know about BDD are

  1. Dan North created first BDD framework – Jbehave
  2. Other BDD frameworks are Rbehave, Specflow, Rspec, Cucumber, Behat
  3. The tests are written in plain text in the form of stories or features
  4. The Domain specific language (Gherkin) is used for writing the tests.

What is Gherkin?

Gherkin is the plain text language used to write feature files (also called as story files) in BDD frameworks like cucumber. Gherkin is implemented in most of languages in the world like English, German, French….many more. This means that any project stakeholder can write, read and understand the tests written in Gherkin. That’s the crux of the Gherkin language.

Sample Gherkin Feature file

Feature: ATM Card authentication
    User should be asked for the PIN once ATM card is inserted into the ATM machine.
    User should be given warning message if PIN number entered is wrong.
User should be authenticated successfully if PIN number entered is correct.

  Scenario: Enter wrong PIN at ATM
    Given I insert the ATM card in ATM machine
    And I am asked to enter the PIN
    When I enter the correct PIN
    Then I should be able to see option to withdraw money
Youtube | Facebook | Twitter | Website Home | Online Grocery Shopping Brisbane