BDD:
Behavior driven development is an agile software development technique that defines the behavior of the feature through plain text.
Gherkin:
Gherkin is the language that cucumber understands. It is business readable language that describes business behavior without the need of implementation. This makes easy simple documentation and uses plain language where everyone understands the behavior of the software.
Gherkin has the common keywords in a plain language can be used and get the same output in form of test scripts. Gherkin serves two purposes- documentation and automated tests
Gherkin Syntax:
Feature : Scenario Title
Given : Precondition
When : Event
Then : Expected Output
Examples of Gherkin :
Feature: Amazon Prime Subscription
Amazon customer wants to make preference in account prime subscription
Scenario 1:Subscribe to prime subscription
Given: The customer as the amazon account
When: The customer subscribes to prime
Then: The customer should be able to subscribe
Scenario 2: Subscribe to different monthly plan subscription
Given: The customer prefers prime plan account
When: The customer selects the monthly plan
Then: The customer should be added for monthly prime membership
Scenario 3: Subscribe to annual plan subscription
Given: The customer prefers prime plan and as the amazon account
When: The customer choose the option prime annual membership
Then : The customer able to add the annual membership
Scenario 4: Subscribe to the student prime account
Given: The customer as a amazon account
When: The customer as the student email id
Then: The customer should be able to subscribe with the student prime account
Scenario 5 : unsubscribe to prime subscription
Given : The customer has prime account
When : Customer decided to cancel the subscription and as the prime subscription
Then: Under mange the subscription end membership
Scenario 6: To update the prime subscription
Given: The customer wants the reminder before the subscription
When: Customer wants the reminder before renewing
Then: The reminder should be sent before renewal
Scenario 7: to view the payment of prime membership
Given: The prime membership is subscribed
When: The customer wants to see all the last payments
Then: The customer should see the receipts
Scenario 8: to update the payment method
Given: The prime membership is subscribed
When: The customer wants to change the credit card details
Then: The customer changes the credit card info
Scenario 9: when prime is expired
Given: The prime membership is subscribed but its expired
When :The customer doesn't have the credit card details
Then :The customer should see the payment page
Scenario 10: when prime login is invalid
Given: The email is invalid
when: The customer enters invalid email and valid password
Then: The page should say invalid email
Commentaires