12. Example
Story: Account Holder withdraws cash
As an Account Holder
I want to withdraw cash from ATM
So that I can get the money when the bank is closed
Scenario 1: Account has sufficient amount
Given the account balance is 100$
And the card is valid
And the ATM 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
13. Example
Story: Account Holder withdraws cash
As an Account Holder
I want to withdraw cash from ATM
So that I can get the money when the bank is closed
Scenario 2: Account has insufficient amount
Given the account balance is 10$
And the card is valid
And the ATM contains enough money
When the Account Holder requests 20$
Then the ATM should not dispense any money
And the account balance should be remain 10$
And the card should be returned
14. Example
Story: Account Holder withdraws cash
As an Account Holder
I want to withdraw cash from ATM
So that I can get the money when the bank is closed
Scenario 3: Card is invalid
Given the account balance is 1000$
And the card is invalid
And the ATM contains enough money
When the Account Holder requests 20$
Then the ATM should not dispense any money
And the ATM should retain the card
And the card should not be returned
15. Gherkins and Cucumber
•Given I have 3 red balls
•Then the kids will be happy
@Given("I have {int} red balls")
def i_have_red_balls(int balls) {
println “we will test “ +balls + “ balls with cucumber”
}
@Then(“the kids will be {status}”)
def the_kids_will_be(String status) {
println “The kids seems “ +status +
}