Behavior-Driven Development (BDD)
And Automation Testing With
Cucumber
TRONG BUI & THONG NGUYEN
STC 2014
Sample Requirement
Feature: login to the system.
As a user,
I want to login into the system when I provide username and
password.
Scenario: login successfully
Given the login page is opening
When I input username into the username textbox
And I input valid password into the password textbox
And I click Login button
Then I am on the Home page
2
Automation Test
@Test
public void fb_login_test() throws Exception {
driver.get("https://www.facebook.com/");
driver.findElement(By.id("email")).clear();
driver.findElement(By.id("email")).sendKeys("bddtest@yahoo.com");
driver.findElement(By.id("pass")).clear();
driver.findElement(By.id("pass")).sendKeys("********");
driver.findElement(By.id("u_0_e")).click();
}
3
Automation Test?
Feature: login to the system.
As a user,
I want to login into the system when I provide username and
password.
Scenario: login successfully
Given the login page is opening
When I input username into the username textbox
And I input valid password into the password textbox
And I click Login button
Then I am on the Home page
4
Behavior-Driven Development
(BDD)
And Automation Testing With
Cucumber
5
AGENDA
 Behavior-driven development
 Automation Testing with Cucumber
 BDD/Cucumber – Pros & Cons
 Q&A
6
7
Behavior-driven development
Behavior-driven
development
8
Given, When, Then
9
10
AUTOMATION TESTING WITH
CUCUMBER
Cucumber Approach
11
Given /^I launch "([^"]*)" page$/ do |page|
visit(page)
End
When /^I fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
fill_in field, :with => value
end
Feature: Login to Email system.
As an employee, I want to login into my email system with
provided username and password.
Scenario: Verify that employee could login email system
Given I launch "https://accounts.google.com" page
When I fill in “Email " with “hcmc-stc-12-jul@gmail.com"
And I fill in “Passwd" with “hcmc-stc-passwd"
And I click on "signIn" button
Then I am on the “Home” page
Scenario Example in BDD
Format
Feature: Login to Email system.
As an employee, I want to login into my email system with provided username and
password.
Scenario: Verify that employee could login email system
@tag_login_email
Scenario Outline: Verify that can login gmail
Given I launch "https://accounts.google.com" page
When I fill in “Email " with “<Email >"
And I fill in “Passwd" with "<Password> "
And I click on "signIn" button
Then I am on the “Home” page
Scenarios:
| Email | Password |
| hcmc-stc-12-jul@gmail.com | hcmc-stc@2013|
| hcmc-stc-user@gmail.com | hcmc-stc@1234|
12
Summary
13
Demo
• Web application:
Cucumber + Capybara
• Web services:
Cucumber + HTTParty + Savon
14
Demo: Web Application
15
Feature: Login to Email system.
As an employee, I want to login into my email system with provided username and
password.
Scenario: Verify that employee could login email system
@tag_login_email
Scenario Outline: Verify that employee could login email system
Given I launch "https://accounts.google.com" page
When I fill in “Email " with “<Email >"
And I fill in “Passwd" with "<Password> "
And I click on "signIn" button
Then I should see text "<Message>“
Scenarios:
| Email | Password | Message |
| demo01.hcmc.stc@gmail.com | demo@2013 | Primary Email demo01… |
| demo02.hcmc.stc@gmail.com | demo1@1234 | Primary Email demo02… |
| Nonexist.hcmc.stc@gmail.com | demo1@1234 | Invalid email or password|
Demo: Web Services
Feature: Get Weather status to display on webpage
As an owner of Traveling Service, I want to be able to get weather status of
any location based on address of client's request
Scenario Outline: Get weather status by address of client's requests
Given The check IP location and weather web services are running
When I send request to get location detail of address "<Address>"
Then I should have ZIP code and "<Country>" of that location
And I send request to get weather status of that location by its ZIP code
Then I should receive current "Temperature, Wind, RelativeHumidity"
and "<City_Name>" and "<State>" of that location
Scenarios:
|Address |Country |City_Name |State |
|www.google.com |United States |Mountain View |California|
16
17
BDD/CUCUMBER – PROS &
CONS
18
BDD/Cucumber - Pros
 BBD is FRIENDLY and UNDERSTANDABLE by non-
technical users
 Great support from RUBY community - Automation
framework based BDD Cucumber is NOT REALLY
HARD to develop and maintenance
 Support on MULTIPLE PLATFORM, OS and different
browsers
19
BDD/Cucumber - Cons
 Incompatibility among GEM versions
 Lacking of tool for managing Features and
Scenarios effectively
20
Q&A
References
21
• All about BDD Cucumber: http://cukes.info/
• BDD cucumber book: http://www.amazon.com/The-Cucumber-
Book-Behaviour-Driven-Development/dp/1934356808
• Ruby gems: http://rubygems.org
• Ruby programming: http://www.ruby-lang.org
© 2014 HCMC Software Testing Club
THANK YOU

More Related Content

PPTX
BDD / cucumber /Capybara
PDF
Behavior Driven Development with Cucumber
PDF
Behavior Driven Development and Automation Testing Using Cucumber
PDF
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
PDF
Behavior Driven Development - How To Start with Behat
PDF
BDD with cucumber
PPT
Testing Any Site With Cucumber and Selenium
PDF
BDD in Java using Cucumber
BDD / cucumber /Capybara
Behavior Driven Development with Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
Behavior Driven Development - How To Start with Behat
BDD with cucumber
Testing Any Site With Cucumber and Selenium
BDD in Java using Cucumber

What's hot (20)

PDF
greach 2014 marco vermeulen bdd using cucumber jvm and groovy
PPTX
Web automation in BDD
PPT
Behavior Driven Development (BDD) and Agile Testing
PPTX
CUCUMBER - Making BDD Fun
PPTX
Test automation with Cucumber-JVM
PPTX
Enough with the javas cript already! de Nicholas Zakas
PDF
Story Driven Development With Cucumber
PDF
RSpec User Stories
PDF
Understanding and testing restful web services
PPT
Selenium and Cucumber Selenium Conf 2011
PPTX
Disrupting the application eco system with progressive web applications
PPTX
Chanhao Jiang And David Wei Presentation Quickling Pagecache
PDF
Usability in the GeoWeb
PPTX
Front-End Single Point of Failure - Velocity 2016 Training
PPTX
Gherkin for test automation in agile
PDF
Selenium - The page object pattern
PDF
Scalable web application architecture
PPTX
Writing automation tests with python selenium behave pageobjects
PDF
Writing Software not Code with Cucumber
PDF
WebApp / SPA @ AllFacebook Developer Conference
greach 2014 marco vermeulen bdd using cucumber jvm and groovy
Web automation in BDD
Behavior Driven Development (BDD) and Agile Testing
CUCUMBER - Making BDD Fun
Test automation with Cucumber-JVM
Enough with the javas cript already! de Nicholas Zakas
Story Driven Development With Cucumber
RSpec User Stories
Understanding and testing restful web services
Selenium and Cucumber Selenium Conf 2011
Disrupting the application eco system with progressive web applications
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Usability in the GeoWeb
Front-End Single Point of Failure - Velocity 2016 Training
Gherkin for test automation in agile
Selenium - The page object pattern
Scalable web application architecture
Writing automation tests with python selenium behave pageobjects
Writing Software not Code with Cucumber
WebApp / SPA @ AllFacebook Developer Conference
Ad

Viewers also liked (20)

PDF
Behavior Driven Development (BDD)
PPTX
Behavior Driven Development
PPT
Nhập môn BDD
PPTX
Phát triển hướng hành vi - Behavior Driven Development - BDD
PPTX
Selenium basic
PDF
Bdd and-testing
PPTX
Selenium topic 1- Selenium Basic
PPTX
BDD in Automation Testing
PPTX
Automated Tests in Agile based on Serenity BDD - Michał Szybalski
PPTX
Serenity BDD Workshop - 9th March 2016
KEY
Ui BDD Testing
PDF
Serenity BDD - from executable specifications to living documentation
PDF
Selenium
PPTX
Test Automation Frameworks: Assumptions, Concepts & Tools
PDF
Selenium web driver
PPTX
Behavior Driven Development - Live Webinar
PDF
Serenity-BDD training
PPTX
Selenium topic 3 -Web Driver Basics
PPTX
BDD presentation
PPTX
Basic Selenium Training
Behavior Driven Development (BDD)
Behavior Driven Development
Nhập môn BDD
Phát triển hướng hành vi - Behavior Driven Development - BDD
Selenium basic
Bdd and-testing
Selenium topic 1- Selenium Basic
BDD in Automation Testing
Automated Tests in Agile based on Serenity BDD - Michał Szybalski
Serenity BDD Workshop - 9th March 2016
Ui BDD Testing
Serenity BDD - from executable specifications to living documentation
Selenium
Test Automation Frameworks: Assumptions, Concepts & Tools
Selenium web driver
Behavior Driven Development - Live Webinar
Serenity-BDD training
Selenium topic 3 -Web Driver Basics
BDD presentation
Basic Selenium Training
Ad

Similar to [Thong Nguyen & Trong Bui] Behavior Driven Development (BDD) and Automation Testing with Cucumber (20)

PPTX
Cucumber_Training_ForQA
PPTX
Hands on BDD with cucumber - Agile Goa Sept 2013
PDF
Behavioral Driven Development
PPTX
Testing with cucumber testing framework
PDF
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
PPTX
SGIN2013-ScrumStartRek-CucumberRecipes-SonikChopra
PDF
Mastering BDD with Cucumber & Java for Test Automation
PDF
cucumber harpal.pdf
PDF
Cucumber Basics.pdf
PDF
Introduction to BDD with Cucumber for Java
PPTX
Sexy Using Cucumber - BDD in your project
PDF
Sgin2013 scrum startrek-cucumber recipes-sonikchopra
PDF
Implementing Testing for Behavior-Driven Development Using Cucumber
PPTX
Xamariners - BDD + Mobile
KEY
PDF
Bridging the gap between business and it using cucumber
PPTX
Introduction to Bdd and cucumber
PDF
Selenium with Cucumber
PDF
Selenium with Cucumber
PDF
Selenium with Cucumber
Cucumber_Training_ForQA
Hands on BDD with cucumber - Agile Goa Sept 2013
Behavioral Driven Development
Testing with cucumber testing framework
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
SGIN2013-ScrumStartRek-CucumberRecipes-SonikChopra
Mastering BDD with Cucumber & Java for Test Automation
cucumber harpal.pdf
Cucumber Basics.pdf
Introduction to BDD with Cucumber for Java
Sexy Using Cucumber - BDD in your project
Sgin2013 scrum startrek-cucumber recipes-sonikchopra
Implementing Testing for Behavior-Driven Development Using Cucumber
Xamariners - BDD + Mobile
Bridging the gap between business and it using cucumber
Introduction to Bdd and cucumber
Selenium with Cucumber
Selenium with Cucumber
Selenium with Cucumber

More from Ho Chi Minh City Software Testing Club (20)

PDF
Web API Test Automation Using Frisby & Node.js
PDF
Building an effective mobile testing strategy
PDF
Common Web UI Problems Transforming Manual to Automation
PDF
Introduction to Back End Automation Testing - Nguyen Vu Hoang, Hoang Phi
PDF
Test Design with Action-based Testing Methodology - Ngo Hoang Minh
PDF
Security testing-What can we do - Trinh Minh Hien
PDF
Deliver Fast, Break Nothing Via Effective Building Developer and Tester Colla...
PDF
Analytical Risk-based and Specification-based Testing - Bui Duy Tam
PDF
Agile Testing - Not Just Tester’s Story _ Dang Thanh Long
PDF
A Novel Approach of Automation Test for Software Monitoring Solution - Tran S...
PDF
Mobile Video Games Testing Principles - Benjamin Poirrier
PDF
The New Agile Testing Quadrants: Bringing Skilled Testers and Developers Toge...
PDF
Key Factors To Ensure Test Automation Framework Success
PDF
Why a Mobile Test Strategy is just Test Strategy
PDF
[HCMC STC Jan 2015] Risk-Based Software Testing Approaches
PDF
[HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios
PDF
[HCMC STC Jan 2015] Practical Experiences In Test Automation
PDF
[HCMC STC Jan 2015] Making IT Count – Agile Test Metrics
PDF
[HCMC STC Jan 2015] Workshop Of Context-Driven Testing In Agile
PDF
[HCMC STC Jan 2015] Developing an Offshore Context-Driven Testing Team
Web API Test Automation Using Frisby & Node.js
Building an effective mobile testing strategy
Common Web UI Problems Transforming Manual to Automation
Introduction to Back End Automation Testing - Nguyen Vu Hoang, Hoang Phi
Test Design with Action-based Testing Methodology - Ngo Hoang Minh
Security testing-What can we do - Trinh Minh Hien
Deliver Fast, Break Nothing Via Effective Building Developer and Tester Colla...
Analytical Risk-based and Specification-based Testing - Bui Duy Tam
Agile Testing - Not Just Tester’s Story _ Dang Thanh Long
A Novel Approach of Automation Test for Software Monitoring Solution - Tran S...
Mobile Video Games Testing Principles - Benjamin Poirrier
The New Agile Testing Quadrants: Bringing Skilled Testers and Developers Toge...
Key Factors To Ensure Test Automation Framework Success
Why a Mobile Test Strategy is just Test Strategy
[HCMC STC Jan 2015] Risk-Based Software Testing Approaches
[HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios
[HCMC STC Jan 2015] Practical Experiences In Test Automation
[HCMC STC Jan 2015] Making IT Count – Agile Test Metrics
[HCMC STC Jan 2015] Workshop Of Context-Driven Testing In Agile
[HCMC STC Jan 2015] Developing an Offshore Context-Driven Testing Team

Recently uploaded (20)

PPTX
Chapter 1 - Transaction Processing and Mgt.pptx
PDF
CapCut PRO for PC Crack New Download (Fully Activated 2025)
PPT
3.Software Design for software engineering
PPTX
Human-Computer Interaction for Lecture 2
PPTX
HackYourBrain__UtrechtJUG__11092025.pptx
PPTX
ROI from Efficient Content & Campaign Management in the Digital Media Industry
PPTX
Post-Migration Optimization Playbook: Getting the Most Out of Your New Adobe ...
PDF
Odoo Construction Management System by CandidRoot
PDF
Sanket Mhaiskar Resume - Senior Software Engineer (Backend, AI)
PPTX
WJQSJXNAZJVCVSAXJHBZKSJXKJKXJSBHJBJEHHJB
PDF
Building an Inclusive Web Accessibility Made Simple with Accessibility Analyzer
PPTX
Foundations of Marketo Engage: Nurturing
DOCX
Industrial Bio-Lynx: Advanced Biometric Solution for Workforce Management
PPTX
Lecture 5 Software Requirement Engineering
PDF
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
PDF
MAGIX Sound Forge Pro CrackSerial Key Keygen
PPTX
SmartGit 25.1 Crack + (100% Working) License Key
PPTX
Folder Lock 10.1.9 Crack With Serial Key
PPTX
Lesson-3-Operation-System-Support.pptx-I
PDF
infoteam HELLAS company profile 2025 presentation
Chapter 1 - Transaction Processing and Mgt.pptx
CapCut PRO for PC Crack New Download (Fully Activated 2025)
3.Software Design for software engineering
Human-Computer Interaction for Lecture 2
HackYourBrain__UtrechtJUG__11092025.pptx
ROI from Efficient Content & Campaign Management in the Digital Media Industry
Post-Migration Optimization Playbook: Getting the Most Out of Your New Adobe ...
Odoo Construction Management System by CandidRoot
Sanket Mhaiskar Resume - Senior Software Engineer (Backend, AI)
WJQSJXNAZJVCVSAXJHBZKSJXKJKXJSBHJBJEHHJB
Building an Inclusive Web Accessibility Made Simple with Accessibility Analyzer
Foundations of Marketo Engage: Nurturing
Industrial Bio-Lynx: Advanced Biometric Solution for Workforce Management
Lecture 5 Software Requirement Engineering
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
MAGIX Sound Forge Pro CrackSerial Key Keygen
SmartGit 25.1 Crack + (100% Working) License Key
Folder Lock 10.1.9 Crack With Serial Key
Lesson-3-Operation-System-Support.pptx-I
infoteam HELLAS company profile 2025 presentation

[Thong Nguyen & Trong Bui] Behavior Driven Development (BDD) and Automation Testing with Cucumber

  • 1. Behavior-Driven Development (BDD) And Automation Testing With Cucumber TRONG BUI & THONG NGUYEN STC 2014
  • 2. Sample Requirement Feature: login to the system. As a user, I want to login into the system when I provide username and password. Scenario: login successfully Given the login page is opening When I input username into the username textbox And I input valid password into the password textbox And I click Login button Then I am on the Home page 2
  • 3. Automation Test @Test public void fb_login_test() throws Exception { driver.get("https://www.facebook.com/"); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("[email protected]"); driver.findElement(By.id("pass")).clear(); driver.findElement(By.id("pass")).sendKeys("********"); driver.findElement(By.id("u_0_e")).click(); } 3
  • 4. Automation Test? Feature: login to the system. As a user, I want to login into the system when I provide username and password. Scenario: login successfully Given the login page is opening When I input username into the username textbox And I input valid password into the password textbox And I click Login button Then I am on the Home page 4
  • 6. AGENDA  Behavior-driven development  Automation Testing with Cucumber  BDD/Cucumber – Pros & Cons  Q&A 6
  • 11. Cucumber Approach 11 Given /^I launch "([^"]*)" page$/ do |page| visit(page) End When /^I fill in "([^"]*)" with "([^"]*)"$/ do |field, value| fill_in field, :with => value end Feature: Login to Email system. As an employee, I want to login into my email system with provided username and password. Scenario: Verify that employee could login email system Given I launch "https://accounts.google.com" page When I fill in “Email " with “[email protected]" And I fill in “Passwd" with “hcmc-stc-passwd" And I click on "signIn" button Then I am on the “Home” page
  • 12. Scenario Example in BDD Format Feature: Login to Email system. As an employee, I want to login into my email system with provided username and password. Scenario: Verify that employee could login email system @tag_login_email Scenario Outline: Verify that can login gmail Given I launch "https://accounts.google.com" page When I fill in “Email " with “<Email >" And I fill in “Passwd" with "<Password> " And I click on "signIn" button Then I am on the “Home” page Scenarios: | Email | Password | | [email protected] | hcmc-stc@2013| | [email protected] | hcmc-stc@1234| 12
  • 14. Demo • Web application: Cucumber + Capybara • Web services: Cucumber + HTTParty + Savon 14
  • 15. Demo: Web Application 15 Feature: Login to Email system. As an employee, I want to login into my email system with provided username and password. Scenario: Verify that employee could login email system @tag_login_email Scenario Outline: Verify that employee could login email system Given I launch "https://accounts.google.com" page When I fill in “Email " with “<Email >" And I fill in “Passwd" with "<Password> " And I click on "signIn" button Then I should see text "<Message>“ Scenarios: | Email | Password | Message | | [email protected] | demo@2013 | Primary Email demo01… | | [email protected] | demo1@1234 | Primary Email demo02… | | [email protected] | demo1@1234 | Invalid email or password|
  • 16. Demo: Web Services Feature: Get Weather status to display on webpage As an owner of Traveling Service, I want to be able to get weather status of any location based on address of client's request Scenario Outline: Get weather status by address of client's requests Given The check IP location and weather web services are running When I send request to get location detail of address "<Address>" Then I should have ZIP code and "<Country>" of that location And I send request to get weather status of that location by its ZIP code Then I should receive current "Temperature, Wind, RelativeHumidity" and "<City_Name>" and "<State>" of that location Scenarios: |Address |Country |City_Name |State | |www.google.com |United States |Mountain View |California| 16
  • 18. 18 BDD/Cucumber - Pros  BBD is FRIENDLY and UNDERSTANDABLE by non- technical users  Great support from RUBY community - Automation framework based BDD Cucumber is NOT REALLY HARD to develop and maintenance  Support on MULTIPLE PLATFORM, OS and different browsers
  • 19. 19 BDD/Cucumber - Cons  Incompatibility among GEM versions  Lacking of tool for managing Features and Scenarios effectively
  • 21. References 21 • All about BDD Cucumber: http://cukes.info/ • BDD cucumber book: http://www.amazon.com/The-Cucumber- Book-Behaviour-Driven-Development/dp/1934356808 • Ruby gems: http://rubygems.org • Ruby programming: http://www.ruby-lang.org
  • 22. © 2014 HCMC Software Testing Club THANK YOU