The BDD Process and
Workflow
Marko Vajs
Software Development Engineer in Test
Phases of BDD
Discovery
Automation Formulation
Discovery of User Stories
Discovery of User Stories
Requires initial requirements to be present
Requires all team members with different
technical backgrounds and a business
representative
The goal is to generate just enough examples
to describe the behavior of a system
Example mapping can be used to structure
and ease this process
Example Mapping
User
Story
Rule 1
Rule 4
Rule 2
Rule 5
Rule 3
Example Mapping
User
Question
Story
Rule 2 Rule 3 Question
Rule 1 Rule 4 Rule 5
Example
Example Example Example Example
Example
Example
Formulation of Scenarios
Formulation of Scenarios
Process of turning a shared understanding of how a system should behave into a
business readable specification.
Collaboration Supported Format
To ensure that the language used in That is understood by a test
scenarios will convey the same automation software
meaning to all parties
Gherkin
Syntax designed to be a non-technical and human-readable way of describing
use cases in software.
Feature: Adding Items to the Shopping Cart
The shopping cart contains items ready to be purchased by a user
Scenario: Adding a single item to the shopping cart
Given a user is on the product page
When the user clicks the "Add to Cart" button for the item "Phone
Charger"
Then the item "Phone Charger" should be added to the shopping cart
And the shopping cart's total items count should increase by 1
Transforming Scenarios into Executable
Specifications
The Behavior-driven Development Process
Scenarios Tests
Examples
Acceptance
Criteria
Refinement
// lines from the Java class
@Given("a user is on the product page")
public void userIsOnProductPageStep() {
@When("the user clicks the \"Add to Cart\" button for the item \"Phone Charger\"")
public void userClicksAddToCartButtonStep() {
// lines from the feature file
Given a user is on the product page
When the user clicks the "Add to Cart" button for the item "Phone Charger"
…
The Dual Purpose of Automated Scenarios
Tests Documentation