☰ See All Chapters |
Why Cucumber Framework
Cucumber framework can be used by anyone and test cases can be read and written very easily. Cucumber framework is a ubiquitous language and understood by everyone involved in the project. Customers can express their requirement in clear and understandable language. By reading the test cases any one can visualize the system before it has been built. Anyone on the team can read a test case and reply their understanding of what the system should do, and it may well spark their imagination into thinking of other scenarios that you’ll need to consider too.
By writing test cases customer expresses how the system should behave after its complete development. This process of test driven development is called as behaviour driven development. Behaviour Driven Development (BDD) builds upon Test Driven Development (TDD) by changing the test cases to expected behaviours.
Below is a simple syntax of cucumber acceptance test:
Feature: Story
Scenario: Main flow
Given Login as a [role]
Then I want [feature]
Then [benefit]
Scenario: Acceptance criteria
Given [initial context]
When [event]
Then [outcomes]
Below is an example of a cucumber acceptance test:
Feature: Story
Scenario: Main flow
Given Login as a customer
Then I want to withdraw money from an ATM
Then I don’t have to go to the bank
Scenario: Acceptance criteria
Given there is enough money on my account
When I make a withdrawal
Then I get the expected amount of money from the ATM
All Chapters