Behavior Driven Testing is an extension of Test Driven Development and BDD Test Approach more focus on user functionality and Tests are writing as a behavior of products/applications. Test cases are written first and development and testing happen based on the scenarios.
Benefits of BDD approach
- Manual testing and Automation testing on sync and fewer chances of documentation and quick delivery with quality product
- Everyone understand and easy to explain to all stakeholders including nontechnical persons and new members.
- Fit for Agile environment and help to improve the collaborative way to communicate to across team members ( Product owners, BA, Developer, and Tester)
- Gherkin is the language that uses in Cucumber tool.
Template for Gherkin language:
#Author: your.email@your.domain.com
#Keywords Summary :
#Feature: List of scenarios.
#Scenario: Business rule through list of steps with arguments.
#Given: Some precondition step
#When: Some key actions
#Then: To observe outcomes or validation
#And,But: To enumerate more Given,When,Then steps
#Scenario Outline: List of steps for data-driven as an Examples and <placeholder>
#Examples: Container for s table
#Background: List of steps run before each of the scenarios
#””” (Doc Strings)
#| (Data Tables)
#@ (Tags/Labels):To group Scenarios
#<> (placeholder)
#””
## (Comments)
#Sample Feature Definition Template
@tag
Feature: Title of your feature
I want to use this template for my feature file
@tag1
Scenario: Title of your scenario
Given I want to write a step with precondition
And some other precondition
When I complete action
And some other action
And yet another action
Then I validate the outcomes
And check more outcomes
@tag2
Scenario Outline: Title of your scenario outline
Given I want to write a step with <name>
When I check for the <value> in step
Then I verify the <status> in step
Examples:
| name |value | status |
| name1 | 5 | success|
| name2 | 7 | Fail |