2.9. Scenarios / Feature Files

Here is a very very very brief about BDD.

For BDD we write features/scenarios/test specification like this:

# features/sample-addition.feature

Feature: Simple Addition

    Showcase simple addition for the BDD Book.

    Scenario: Addition of single digit numbers
        Given I have '1' and '3'
        When I add them
        Then The result must be '4'

    Scenario: Addition of double digit numbers
        Given I have '70' and '29'
        When I add them
        Then The result must be '99'

As you can see, the scenarios are written in plain English.

A feature is a group/collection of scenarios.

Each scenarios has multiple steps:

PreCondition:

It begins with Given

Cause:

It begins with When

Effect:

It begins with Then

You can also use And, But to extend the list of steps.