On Github linclark / bdd-slides
What's in a Story by Dan Northedited to use Behat style
A tool to help devs, QA, and stakeholders communicate betterusing simple sentences to describe requirementsin a structured way,which can then be automatically executed as tests.
What if we were on the Wikipedia team, introducing multilingual support for the first time.
Given I am on "http://es.wikipedia.org/" When I type "United States" in the search box And I press enter Then I should see the heading "Estados Unidos" And I should see the text "(Redirigido desde «United States»)"
Feature: Account Holder withdraws cash I want to withdraw cash from an ATM As an Account Holder So that I can get money when the bank is closed Scenario: Account has sufficient funds Given the account balance is $100 And the card is valid And the machine contains enough money When the Account Holder requests $20 Then the ATM should dispense $20 And the account balance should be $80 And the card should be returned Scenario: Account has insufficient funds ...
Feature: Account Holder withdraws cash
describes an action taken by a user
I want to withdraw cash from an ATM As an Account Holder So that I can get money when the bank is closed
Scenario: Account has sufficient funds ... Scenario: Account has insufficient funds ...
indicate what's different between the scenarios
Given the account balance is $100 And the card is valid And the machine contains enough money When the Account Holder requests $20 Then the ATM should dispense $20 And the account balance should be $80 And the card should be returned
(aka Givens, Whens, and Thens)
Given the account balance is $100 And the card is valid And the machine contains enough money
should define all of, and no more than, the required context
When the Account Holder requests $20
simple, one line if possible
Then the ATM should dispense $20 And the account balance should be $80 And the card should be returned