Gherkin is a business readable DSL that lets you describe software behaviour without detailing how that behaviour is implemented.

Syntax

Feature

Scenario

Step: defined in .feature files

Step Definition

Given When Then

### Given: Put the system in a known state. * Avoid talking about user interactions in givens. * You can use Given’s with a multiline table argument.

When: Describe the key action

Then: Observe Outcomes

And, But

Scenario: Multiple Givens
    Given one thing
    Given another thing
    Given yet another thing
    When I open my eyes
    Then I see something
    Then I don't see something else.
Scenario: Multiple Givens
    Given one thing
    And another thing
    And yet another thing
    When I open my eyes
    Then I see something
    But I don't see something else.

Given, When, Then: State Machine (Finite State Machine)

Better language to describe automated requirements, we will improve the way we think about those requirements, and therefore write better requirements. - Uncle Bob

The best way to describe the requirements of a system is to describe it as a Turing Machine. - Uncle Bob

Behaviour Driven Development (BDD)

Specialized version of TDD which focuses on behavioural specifications of software units.

User Story:

Acceptance Criteria:

Behavioural Specification

Each user story, in some way, should follow the following structure.

Title:

Narrative:

Acceptance Criteria:

Scenario’s are ideally phrased declaratively rather than imperatively in the business language with no reference to elements of the UI through which the interactions take place.

BDD caters to the idea of specification as a ubiquitous language.

comments powered by Disqus