SlideShare a Scribd company logo
BDD: Behind the Scenes
github: https://github.com/nazarii-piontko/ToDo-BDD
To be discussed
● What is BDD
● Building blocks:
○ Cucumber/Gherkin
○ Selenium
○ Docker
● Get everything together
● Example
What is BDD
Cucumber
● Executable Specifications.
● Runs automated acceptance tests.
● Software behaviors is specified in a logical
language that customers can understand.
● Central to the Cucumber BDD approach is its
plain language parser called Gherkin.
● Ruby, Java, Python, .NET, JavaScript, etc.
Gherkin Syntax
Feature: Google Searching.
As a web surfer,
I want to search with Google.
Scenario: Simple Google search
Given a web browser is on the Google page
When the search phrase "python" is entered
And the search button pressed
Then results for "python" are shown
And the following results are shown
|results |
|Welcome to Python.org |
|Python Tutorial - W3Schools|
Gherkin keywords
● Feature
● Scenario
● Given, When, Then, And, But
● Background
● Scenario Outline, Examples
Scenario Outline: eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |https://cucumber.io/docs/gherkin/reference/
Gherkin steps
Given a web browser is on the Google page
@given('a web browser is on the Google page')
def browser_is_on_the_google_page(context):
...
When the search phrase "python" is entered
@when('the search phase "{query}" is entered')
def search_phase_is_entered(context, query):
...
Then results for "python" are shown
@then('results for "{query}" are shown')
def results_are_shown(context, query):
assert ...
Environmental Control (Hooks)
before_all
for feature in all_features:
before_feature
for scenario in feature.scenarios:
before_scenario
for step in scenario.steps:
before_step
step.run()
after_step
after_scenario
after_feature
after_all
def before_all(context):
...
def before_feature(context, feature):
...
def before_scenario(context, scenario):
...
def before_step(context, step):
...
def after_step(context, step):
...
def after_scenario(context, scenario):
...
def after_feature(context, feature):
...
def after_all(context):
...
Selenium
Real
Browser
Browser
Drivers
Firefox driver
Chrome driver
IE driver
Communication
Protocol over
Network
Selenium
Language
Bindings
.NET
Java
Python
...
Docker
Docker
version: '3.4'
services:
app:
image: npiontko/sample-node-todo
environment:
- PGUSER=postgres
- PGPASSWORD=postgres
- PGDATABASE=todo
- PGSERVER=db
- WAIT_HOSTS=db:5432
- PORT=80
ports:
- 80:80
depends_on:
- db
db:
image: postgres:latest
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=todo
$ docker-compose up Docker
app db
Host OS
Get everything together
Get everything together
Python Behave Selenium Docker
App
Controller
Config
Web Driver
Factory
Utils
Service
Locator
Page
Objects
Asserts
Features Steps
...
Example
Application under the test
Project structure
Features
Steps
Steps
Steps
Hooks
Page Object
Page Object
Page Object
App Controller

More Related Content

PDF
Grooscript greach 2015
PDF
Grooscript gr8conf 2015
ODP
SPRAT - Spreadsheet API Tester
KEY
Git - Some tips to do it better
ODP
Javascript in Linux Desktop
PPTX
Introduction to Gulp
PDF
Acceptance tests
PDF
Gulp - the streaming build system
Grooscript greach 2015
Grooscript gr8conf 2015
SPRAT - Spreadsheet API Tester
Git - Some tips to do it better
Javascript in Linux Desktop
Introduction to Gulp
Acceptance tests
Gulp - the streaming build system

What's hot (20)

PDF
chubbyphp-mock
PDF
Git introduction
PDF
Variable precedence: Where should I put a variable?
PPTX
Git: Why And How to
PPTX
Take A Gulp at Task Automation
PPTX
Working in Team using Git in Unity
PDF
PDF
Kotlin for Web (with Ktor)
PDF
Kotlin for API (with Ktor)
ODP
GulpJs - An Introduction
PDF
RSpec 1.x -> 2.0 の変更点
PDF
Portable class library to .NET Standard Extension
PDF
Why on earth is git super awesome?
PDF
Composer 經典食譜
PDF
Puppeteer - Headless Chrome Node API
PDF
Golang preso
PDF
Introducing gitfs
PPT
GO programming language
PDF
用 Kotlin 做自動化工具
PDF
Unix is my IDE
chubbyphp-mock
Git introduction
Variable precedence: Where should I put a variable?
Git: Why And How to
Take A Gulp at Task Automation
Working in Team using Git in Unity
Kotlin for Web (with Ktor)
Kotlin for API (with Ktor)
GulpJs - An Introduction
RSpec 1.x -> 2.0 の変更点
Portable class library to .NET Standard Extension
Why on earth is git super awesome?
Composer 經典食譜
Puppeteer - Headless Chrome Node API
Golang preso
Introducing gitfs
GO programming language
用 Kotlin 做自動化工具
Unix is my IDE
Ad

Similar to BDD: Behind the Scenes (20)

PPTX
Writing automation tests with python selenium behave pageobjects
KEY
Introduction to Django
ODP
Behat Workshop at WeLovePHP
PDF
Behave manners for ui testing pycon2019
PDF
Develop Android/iOS app using golang
PDF
greach 2014 marco vermeulen bdd using cucumber jvm and groovy
PDF
Hands-on go profiling
PDF
Behat internals for advanced usage. Symfony Camp 2016
PDF
Django dev-env-my-way
PDF
Griffon for the Enterprise
PDF
Acceptance testing with Geb
PDF
Making the most of your Test Suite
PDF
From devOps to front end Ops, test first
PPTX
End-to-end testing with geb
PDF
Golang Project Layout and Practice
PDF
Django for mobile applications
PPTX
Django Portfolio Website Workshop (1).pptx
KEY
國民雲端架構 Django + GAE
PDF
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples)
KEY
PyCon AU 2012 - Debugging Live Python Web Applications
Writing automation tests with python selenium behave pageobjects
Introduction to Django
Behat Workshop at WeLovePHP
Behave manners for ui testing pycon2019
Develop Android/iOS app using golang
greach 2014 marco vermeulen bdd using cucumber jvm and groovy
Hands-on go profiling
Behat internals for advanced usage. Symfony Camp 2016
Django dev-env-my-way
Griffon for the Enterprise
Acceptance testing with Geb
Making the most of your Test Suite
From devOps to front end Ops, test first
End-to-end testing with geb
Golang Project Layout and Practice
Django for mobile applications
Django Portfolio Website Workshop (1).pptx
國民雲端架構 Django + GAE
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples)
PyCon AU 2012 - Debugging Live Python Web Applications
Ad

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
cuic standard and advanced reporting.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PDF
Encapsulation theory and applications.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Electronic commerce courselecture one. Pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Chapter 3 Spatial Domain Image Processing.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
MYSQL Presentation for SQL database connectivity
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Monthly Chronicles - July 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
cuic standard and advanced reporting.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Teaching material agriculture food technology
KodekX | Application Modernization Development
Encapsulation theory and applications.pdf
Spectral efficient network and resource selection model in 5G networks
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

BDD: Behind the Scenes

  • 1. BDD: Behind the Scenes github: https://github.com/nazarii-piontko/ToDo-BDD
  • 2. To be discussed ● What is BDD ● Building blocks: ○ Cucumber/Gherkin ○ Selenium ○ Docker ● Get everything together ● Example
  • 4. Cucumber ● Executable Specifications. ● Runs automated acceptance tests. ● Software behaviors is specified in a logical language that customers can understand. ● Central to the Cucumber BDD approach is its plain language parser called Gherkin. ● Ruby, Java, Python, .NET, JavaScript, etc.
  • 5. Gherkin Syntax Feature: Google Searching. As a web surfer, I want to search with Google. Scenario: Simple Google search Given a web browser is on the Google page When the search phrase "python" is entered And the search button pressed Then results for "python" are shown And the following results are shown |results | |Welcome to Python.org | |Python Tutorial - W3Schools|
  • 6. Gherkin keywords ● Feature ● Scenario ● Given, When, Then, And, But ● Background ● Scenario Outline, Examples Scenario Outline: eating Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers Examples: | start | eat | left | | 12 | 5 | 7 | | 20 | 5 | 15 |https://cucumber.io/docs/gherkin/reference/
  • 7. Gherkin steps Given a web browser is on the Google page @given('a web browser is on the Google page') def browser_is_on_the_google_page(context): ... When the search phrase "python" is entered @when('the search phase "{query}" is entered') def search_phase_is_entered(context, query): ... Then results for "python" are shown @then('results for "{query}" are shown') def results_are_shown(context, query): assert ...
  • 8. Environmental Control (Hooks) before_all for feature in all_features: before_feature for scenario in feature.scenarios: before_scenario for step in scenario.steps: before_step step.run() after_step after_scenario after_feature after_all def before_all(context): ... def before_feature(context, feature): ... def before_scenario(context, scenario): ... def before_step(context, step): ... def after_step(context, step): ... def after_scenario(context, scenario): ... def after_feature(context, feature): ... def after_all(context): ...
  • 9. Selenium Real Browser Browser Drivers Firefox driver Chrome driver IE driver Communication Protocol over Network Selenium Language Bindings .NET Java Python ...
  • 11. Docker version: '3.4' services: app: image: npiontko/sample-node-todo environment: - PGUSER=postgres - PGPASSWORD=postgres - PGDATABASE=todo - PGSERVER=db - WAIT_HOSTS=db:5432 - PORT=80 ports: - 80:80 depends_on: - db db: image: postgres:latest environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=todo $ docker-compose up Docker app db Host OS
  • 13. Get everything together Python Behave Selenium Docker App Controller Config Web Driver Factory Utils Service Locator Page Objects Asserts Features Steps ...
  • 18. Steps
  • 19. Steps
  • 20. Steps
  • 21. Hooks