SlideShare a Scribd company logo
Behavior-Driven Developmentand Automation Testing using Cucumber Framework. 
TrongBui 
KMS-Technologytrongbui@kms-technology.comhttp://www.kms-technology.com 
06|12|2014
About: KMS-Technology 
•Global Company 
–U.S. Company 
–Development Center in Ho Chi Minh City, Vietnam 
–Act local, think global (around-the-clock / distributed global team model) 
–480 resources globally 
•Proven and Experienced 
–Founded in January, 2009 
–100% of clients are reference-able 
–Microsoft Gold Partner 
•Value Driven Philosophy 
–Focus all aspects of business on delivering quality and value to our clients 
2 
BDD AUTOMATION TESTING WITH CUCUMBER
About: Trong Bui 
•QA Architect, Automation Test Lead at KMS-Technology 
•8 years experience in Software testing, including 4 years experience in Automation Test. 
•Test tools: Cucumber, Selenium. 
BDD AUTOMATION TESTING WITH CUCUMBER 3
WebinarAgenda: 
•Introduction 
•What is Behavior Driven Development (BDD) 
•What is Cucumber 
•BDD Automation Test with Cucumber 
•Cucumber Live Demo 
•Appendix: 
–UI Test Setup with Page Object Pattern 
–Cucumber Demo with Page Object Pattern 
BDD AUTOMATION TESTING WITH CUCUMBER 4
Introduction 
BDD AUTOMATION TESTING WITH CUCUMBER 5
Software Development Life Cycle 
BDD AUTOMATION TESTING WITH CUCUMBER 6
Classic example on collaboration skills 
BDD AUTOMATION TESTING WITH CUCUMBER 7
Skill gap and review dependency 
BDD AUTOMATION TESTING WITH CUCUMBER 8
Specific example of an requirement 
Feature: login to the system. 
Asa user, 
I want to login into the system when I provide username and password. 
Scenario:login successfully 
Giventhe login page is opening 
WhenI input username into the username textbox 
AndI input valid password into the password textbox 
AndI click Login button 
ThenI am on the Home page 
BDD AUTOMATION TESTING WITH CUCUMBER 9
and normal Automation Test 
@Test 
public void fb_login_test() throwsException { 
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(); 
} 
BDD AUTOMATION TESTING WITH CUCUMBER 10
What is Behavior Driven Development (BDD) 
BDD AUTOMATION TESTING WITH CUCUMBER 11
Definition: 
Behavior-driven development (or BDD) is an agile software development technique that encourages collaboration between developers, QA and non-technical or business participants in a software project. 
BDD AUTOMATION TESTING WITH CUCUMBER 12
More specific: 
It’sallaboutGiven,WhenandThen–Mapseasilytouserstories 
Extends Test Driven Development (TDD) by utilizing natural language that non-technical stakeholders can understand. 
Encourages collaboration between Domain experts, Business Analysts, QA Engineers, Developers & Business Owners / Stakeholders 
Driven by Business Value and finally, with the aim of delivering "software that matters". 
BDD AUTOMATION TESTING WITH CUCUMBER 13
BDD scenario detail: 
A description of each specific case of the narrative. Such a scenario has the following structure: 
BDD AUTOMATION TESTING WITH CUCUMBER 14
Mapping User storiesto BDD scenarios: 
User story 
BDD scenario 
As a calculator user, I want to add two numbers so that I can do addition. 
Given I have two numbers 500 & 500 When I add them upThen I should get result 1000 
As a Math teacher, I want to automate marks sorting process so that I can declare top 5 in my class. 
Given a list of numbersWhen I sort the listThen the list will be in numerical order 
As a QA engineer, I want to check a critical feature so that I can do smoke test easily. 
Given I visit Google.comWhen I type ‘TestingWhiz' as a search string 
Then I should get search results matching TestingWhiz 
BDD AUTOMATION TESTING WITH CUCUMBER 15
Tooling principles: 
The tooling reads a specification document. 
The tooling directly understands completely formal parts of the ubiquitous language (such as the Given keyword in the example above). 
Each individual clause in a scenario is transformed into some sort of parameter for a test for the user story. 
The framework then executes the test for each scenario, with the parameters from that scenario. 
BDD AUTOMATION TESTING WITH CUCUMBER 16
What is Cucumber 
BDD AUTOMATION TESTING WITH CUCUMBER 17
Cucumber definition: 
From Wikipedia, Cucumberis asoftwaretool thatcomputer programmersuse for testing other software. It runs automatedacceptance testswritten in aBehavior-Driven Development(BDD) style. 
BDD AUTOMATION TESTING WITH CUCUMBER 18
How cucumber works: 
BDD AUTOMATION TESTING WITH CUCUMBER 19
BDD Automation Test with Cucumber 
BDD AUTOMATION TESTING WITH CUCUMBER 20
Example of BDD scenario: 
Feature: login to the system. 
Asa user, 
I want to login into the system when I provide username and password. 
Scenario:login successfully 
Giventhe login page is opening 
WhenI input username into the username textbox 
AndI input valid password into the password textbox 
AndI click Login button 
ThenI am on the Home page 
BDD AUTOMATION TESTING WITH CUCUMBER 21
BDD Scenario with parameters: 
BDD AUTOMATION TESTING WITH CUCUMBER 22
How Cucumber works: 
BDD AUTOMATION TESTING WITH CUCUMBER 
Given/^I launch "([^"]*)" page$/ do |page| 
visit(page) 
End 
When/^I fill in "([^"]*)" with "([^"]*)"$/ do |field, value| 
fill_infield, :with => value 
end 
23
BDD scenario with multi dataset: 
BDD AUTOMATION TESTING WITH CUCUMBER 24
Cucumber Live Demo 
BDD AUTOMATION TESTING WITH CUCUMBER 25
Environment setup: 
•Windows: 
–Install Ruby Installer 
•Download: http://rubyinstaller.org/downloads[Ruby 1.9.3-p125] 
•Install: rubyinstaller-xxx.exe 
•Verify: gem 
–Install Ruby DevKit 
•Download: http://rubyinstaller.org/downloads[DevKit-tdm-32- xxx] 
•Run: DevKit-tdm-32-xxx.exe 
•Generate config.ymlfile: ruby dk.rbinit 
•Install DevKit: ruby dk.rb 
•Test Installation:gem install rdiscount--platform=ruby 
BDD AUTOMATION TESTING WITH CUCUMBER 26
Q&A 
BDD AUTOMATION TESTING WITH CUCUMBER 27
THANK YOU 
© 2013 KMS Technology
APPENDIX 
APPENDIX –PAGE OBJECT PATTERN 29
UI Test Setup with Page Object Pattern 
APPENDIX –PAGE OBJECT PATTERN 30
PAGEOBJECTPATTERN 
Page Object Pattern is UI Automation Test good practice. 
It represents the screens of Web app as a series of objects and encapsulates the features represented by a page. 
It allows us to model the UI in our tests. 
A page object is an object-oriented class that serves as an interface to a page of your AUT. 
APPENDIX –PAGE OBJECT PATTERN 31
Page Object Pattern advantages: 
Reduces the duplication of code 
Makes tests more readable and robust 
Improves themaintainabilityof tests, particularly when there is frequent change in the AUT.(Useful in Agile methodology based projects) 
APPENDIX –PAGE OBJECT PATTERN 32
Cucumber Live Demo with Page Object Pattern 
APPENDIX –PAGE OBJECT PATTERN 33
References 
•Spring + Behavior-Driven-Development 
•Cukes.info 
•The Cucumber Book 
•Page Object Pattern 
BDD AUTOMATION TESTING WITH CUCUMBER 34

More Related Content

What's hot (20)

PPTX
Jenkins presentation
Valentin Buryakov
 
ODP
Test Automation Framework using Cucumber BDD overview (part 1)
Mindfire Solutions
 
PDF
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Edureka!
 
PPTX
Cypress Automation
Susantha Pathirana
 
PPTX
Automation test framework with cucumber – BDD
123abcda
 
PDF
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
PPTX
Introduction to Bdd and cucumber
Nibu Baby
 
PPSX
Cucumber & gherkin language
selvanathankapilan
 
PDF
Selenium with Cucumber
Knoldus Inc.
 
PDF
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
Edureka!
 
PPTX
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Simplilearn
 
PPTX
BDD testing with cucumber
Daniel Kummer
 
PDF
e2e testing with cypress
Tomasz Bak
 
PDF
Getting Started With Cypress
Knoldus Inc.
 
PDF
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
PDF
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
PDF
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
Edureka!
 
PPTX
Saving Time By Testing With Jest
Ben McCormick
 
PPTX
Selenium
Rakshitha Raviprakash
 
Jenkins presentation
Valentin Buryakov
 
Test Automation Framework using Cucumber BDD overview (part 1)
Mindfire Solutions
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Edureka!
 
Cypress Automation
Susantha Pathirana
 
Automation test framework with cucumber – BDD
123abcda
 
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Introduction to Bdd and cucumber
Nibu Baby
 
Cucumber & gherkin language
selvanathankapilan
 
Selenium with Cucumber
Knoldus Inc.
 
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
Edureka!
 
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Simplilearn
 
BDD testing with cucumber
Daniel Kummer
 
e2e testing with cypress
Tomasz Bak
 
Getting Started With Cypress
Knoldus Inc.
 
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
Edureka!
 
Saving Time By Testing With Jest
Ben McCormick
 

Viewers also liked (20)

PDF
Behavior Driven Development with Cucumber
Brandon Keepers
 
ODP
BBD Hands-on with Python. Practical Hands-on Workshop about "Behaviour Driven...
Hemmerling
 
PDF
Bridging the gap between business and technology - Behaviour Driven Developme...
marcin_pajdzik
 
PPTX
Making Watir and Cucumber an efficient tool for Web UI Automation
Ruslan Strazhnyk
 
PPTX
Selenium Camp 2016
Dan Cuellar
 
PDF
Selenium
Andrew Johnstone
 
PPT
Software Testing
Abhishek Saxena
 
KEY
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Shuji Watanabe
 
PPTX
Protractor overview
Abhishek Yadav
 
PPTX
Protractor training
Sergiy Stotskiy
 
PPTX
Protractor for angularJS
Krishna Kumar
 
PDF
Product Owner Challenge - User Stories ready to play
Michael Tarnowski
 
PDF
Ant, Maven and Jenkins
Kenu, GwangNam Heo
 
PPTX
Automated Testing with Cucumber, PhantomJS and Selenium
Dev9Com
 
PPTX
Ci jenkins maven svn
Ankur Goyal
 
PPTX
Product Owner Challenge game
Michael Tarnowski
 
PDF
Introduction to Protractor
Florian Fesseler
 
PPTX
Continuous Delivery With Selenium Grid And Docker
Barbara Gonzalez
 
PPTX
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 
PDF
Protractor: Tips & Tricks
Sergey Bolshchikov
 
Behavior Driven Development with Cucumber
Brandon Keepers
 
BBD Hands-on with Python. Practical Hands-on Workshop about "Behaviour Driven...
Hemmerling
 
Bridging the gap between business and technology - Behaviour Driven Developme...
marcin_pajdzik
 
Making Watir and Cucumber an efficient tool for Web UI Automation
Ruslan Strazhnyk
 
Selenium Camp 2016
Dan Cuellar
 
Software Testing
Abhishek Saxena
 
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Shuji Watanabe
 
Protractor overview
Abhishek Yadav
 
Protractor training
Sergiy Stotskiy
 
Protractor for angularJS
Krishna Kumar
 
Product Owner Challenge - User Stories ready to play
Michael Tarnowski
 
Ant, Maven and Jenkins
Kenu, GwangNam Heo
 
Automated Testing with Cucumber, PhantomJS and Selenium
Dev9Com
 
Ci jenkins maven svn
Ankur Goyal
 
Product Owner Challenge game
Michael Tarnowski
 
Introduction to Protractor
Florian Fesseler
 
Continuous Delivery With Selenium Grid And Docker
Barbara Gonzalez
 
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 
Protractor: Tips & Tricks
Sergey Bolshchikov
 
Ad

Similar to Behavior-Driven Development and Automation Testing Using Cucumber Framework Webinar (20)

PDF
Selenium with Cucumber
Knoldus Inc.
 
PDF
Selenium with Cucumber
Knoldus Inc.
 
PDF
An Overview of Cucumber Automation Testing.pdf
Test Evolve
 
PDF
[@NaukriEngineering] BDD implementation using Cucumber
Naukri.com
 
PDF
cucumber harpal.pdf
VennelaVasupilli
 
PPTX
Lets cook cucumber !!
vodQA
 
PPTX
BDD / cucumber /Capybara
ShraddhaSF
 
PPT
Cucumber And Bdd
joshcrews
 
PPT
BDD along with Continuous Integration
Agile Testing Alliance
 
PPT
Stc 2015 regional-round-ppt-bdd along with ci
Archana Krushnan
 
PPTX
Introduce cucumber
Bachue Zhou
 
PDF
Behavioral Driven Development
Cprime
 
PPTX
BDD from QA side
Anton Shapin
 
PPTX
Bdd with Cucumber and Mocha
Atish Narlawar
 
PDF
Acceptance Test-driven Development with Cucumber-jvm
Christopher Bartling
 
PDF
Testing stage. being ahead business with cucumber
Alex Mikitenko
 
PDF
Introducing BDD and TDD with Cucumber
Knoldus Inc.
 
PPTX
Behavior Driven Development(BDD) by using Cucumber Plugin in Cypress
Arshad QA
 
PDF
Cucumber Selenium Tutorial | Edureka
Edureka!
 
PPTX
What Is Cucumber?
QATestLab
 
Selenium with Cucumber
Knoldus Inc.
 
Selenium with Cucumber
Knoldus Inc.
 
An Overview of Cucumber Automation Testing.pdf
Test Evolve
 
[@NaukriEngineering] BDD implementation using Cucumber
Naukri.com
 
cucumber harpal.pdf
VennelaVasupilli
 
Lets cook cucumber !!
vodQA
 
BDD / cucumber /Capybara
ShraddhaSF
 
Cucumber And Bdd
joshcrews
 
BDD along with Continuous Integration
Agile Testing Alliance
 
Stc 2015 regional-round-ppt-bdd along with ci
Archana Krushnan
 
Introduce cucumber
Bachue Zhou
 
Behavioral Driven Development
Cprime
 
BDD from QA side
Anton Shapin
 
Bdd with Cucumber and Mocha
Atish Narlawar
 
Acceptance Test-driven Development with Cucumber-jvm
Christopher Bartling
 
Testing stage. being ahead business with cucumber
Alex Mikitenko
 
Introducing BDD and TDD with Cucumber
Knoldus Inc.
 
Behavior Driven Development(BDD) by using Cucumber Plugin in Cypress
Arshad QA
 
Cucumber Selenium Tutorial | Edureka
Edureka!
 
What Is Cucumber?
QATestLab
 
Ad

More from KMS Technology (20)

PDF
A journey to a Full Stack Tester
KMS Technology
 
PDF
React & Redux, how to scale?
KMS Technology
 
PDF
Sexy React Stack
KMS Technology
 
PDF
Common design principles and design patterns in automation testing
KMS Technology
 
PDF
[Webinar] Test First, Fail Fast - Simplifying the Tester's Transition to DevOps
KMS Technology
 
PDF
KMSNext Roadmap
KMS Technology
 
PDF
KMS Introduction
KMS Technology
 
PDF
What's new in the Front-end development nowadays?
KMS Technology
 
PDF
JavaScript - No Longer A Toy Language
KMS Technology
 
PDF
JavaScript No longer A “toy” Language
KMS Technology
 
PDF
Preparations For A Successful Interview
KMS Technology
 
PDF
Introduction To Single Page Application
KMS Technology
 
PDF
AWS: Scaling With Elastic Beanstalk
KMS Technology
 
PDF
KMS Introduction
KMS Technology
 
PDF
Technology Application Development Trends For IT Students
KMS Technology
 
PDF
Contributors for Delivering a Successful Testing Project Seminar
KMS Technology
 
PDF
Increase Chances to Be Hired as Software Developers - 2014
KMS Technology
 
PDF
Software Technology Trends in 2013-2014
KMS Technology
 
PDF
Cross-platform Mobile Development with C# and Xamarin Webinar
KMS Technology
 
PDF
Software Testing Process & Trend
KMS Technology
 
A journey to a Full Stack Tester
KMS Technology
 
React & Redux, how to scale?
KMS Technology
 
Sexy React Stack
KMS Technology
 
Common design principles and design patterns in automation testing
KMS Technology
 
[Webinar] Test First, Fail Fast - Simplifying the Tester's Transition to DevOps
KMS Technology
 
KMSNext Roadmap
KMS Technology
 
KMS Introduction
KMS Technology
 
What's new in the Front-end development nowadays?
KMS Technology
 
JavaScript - No Longer A Toy Language
KMS Technology
 
JavaScript No longer A “toy” Language
KMS Technology
 
Preparations For A Successful Interview
KMS Technology
 
Introduction To Single Page Application
KMS Technology
 
AWS: Scaling With Elastic Beanstalk
KMS Technology
 
KMS Introduction
KMS Technology
 
Technology Application Development Trends For IT Students
KMS Technology
 
Contributors for Delivering a Successful Testing Project Seminar
KMS Technology
 
Increase Chances to Be Hired as Software Developers - 2014
KMS Technology
 
Software Technology Trends in 2013-2014
KMS Technology
 
Cross-platform Mobile Development with C# and Xamarin Webinar
KMS Technology
 
Software Testing Process & Trend
KMS Technology
 

Recently uploaded (20)

PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 

Behavior-Driven Development and Automation Testing Using Cucumber Framework Webinar

  • 1. Behavior-Driven Developmentand Automation Testing using Cucumber Framework. TrongBui [email protected]://www.kms-technology.com 06|12|2014
  • 2. About: KMS-Technology •Global Company –U.S. Company –Development Center in Ho Chi Minh City, Vietnam –Act local, think global (around-the-clock / distributed global team model) –480 resources globally •Proven and Experienced –Founded in January, 2009 –100% of clients are reference-able –Microsoft Gold Partner •Value Driven Philosophy –Focus all aspects of business on delivering quality and value to our clients 2 BDD AUTOMATION TESTING WITH CUCUMBER
  • 3. About: Trong Bui •QA Architect, Automation Test Lead at KMS-Technology •8 years experience in Software testing, including 4 years experience in Automation Test. •Test tools: Cucumber, Selenium. BDD AUTOMATION TESTING WITH CUCUMBER 3
  • 4. WebinarAgenda: •Introduction •What is Behavior Driven Development (BDD) •What is Cucumber •BDD Automation Test with Cucumber •Cucumber Live Demo •Appendix: –UI Test Setup with Page Object Pattern –Cucumber Demo with Page Object Pattern BDD AUTOMATION TESTING WITH CUCUMBER 4
  • 5. Introduction BDD AUTOMATION TESTING WITH CUCUMBER 5
  • 6. Software Development Life Cycle BDD AUTOMATION TESTING WITH CUCUMBER 6
  • 7. Classic example on collaboration skills BDD AUTOMATION TESTING WITH CUCUMBER 7
  • 8. Skill gap and review dependency BDD AUTOMATION TESTING WITH CUCUMBER 8
  • 9. Specific example of an requirement Feature: login to the system. Asa user, I want to login into the system when I provide username and password. Scenario:login successfully Giventhe login page is opening WhenI input username into the username textbox AndI input valid password into the password textbox AndI click Login button ThenI am on the Home page BDD AUTOMATION TESTING WITH CUCUMBER 9
  • 10. and normal Automation Test @Test public void fb_login_test() throwsException { 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(); } BDD AUTOMATION TESTING WITH CUCUMBER 10
  • 11. What is Behavior Driven Development (BDD) BDD AUTOMATION TESTING WITH CUCUMBER 11
  • 12. Definition: Behavior-driven development (or BDD) is an agile software development technique that encourages collaboration between developers, QA and non-technical or business participants in a software project. BDD AUTOMATION TESTING WITH CUCUMBER 12
  • 13. More specific: It’sallaboutGiven,WhenandThen–Mapseasilytouserstories Extends Test Driven Development (TDD) by utilizing natural language that non-technical stakeholders can understand. Encourages collaboration between Domain experts, Business Analysts, QA Engineers, Developers & Business Owners / Stakeholders Driven by Business Value and finally, with the aim of delivering "software that matters". BDD AUTOMATION TESTING WITH CUCUMBER 13
  • 14. BDD scenario detail: A description of each specific case of the narrative. Such a scenario has the following structure: BDD AUTOMATION TESTING WITH CUCUMBER 14
  • 15. Mapping User storiesto BDD scenarios: User story BDD scenario As a calculator user, I want to add two numbers so that I can do addition. Given I have two numbers 500 & 500 When I add them upThen I should get result 1000 As a Math teacher, I want to automate marks sorting process so that I can declare top 5 in my class. Given a list of numbersWhen I sort the listThen the list will be in numerical order As a QA engineer, I want to check a critical feature so that I can do smoke test easily. Given I visit Google.comWhen I type ‘TestingWhiz' as a search string Then I should get search results matching TestingWhiz BDD AUTOMATION TESTING WITH CUCUMBER 15
  • 16. Tooling principles: The tooling reads a specification document. The tooling directly understands completely formal parts of the ubiquitous language (such as the Given keyword in the example above). Each individual clause in a scenario is transformed into some sort of parameter for a test for the user story. The framework then executes the test for each scenario, with the parameters from that scenario. BDD AUTOMATION TESTING WITH CUCUMBER 16
  • 17. What is Cucumber BDD AUTOMATION TESTING WITH CUCUMBER 17
  • 18. Cucumber definition: From Wikipedia, Cucumberis asoftwaretool thatcomputer programmersuse for testing other software. It runs automatedacceptance testswritten in aBehavior-Driven Development(BDD) style. BDD AUTOMATION TESTING WITH CUCUMBER 18
  • 19. How cucumber works: BDD AUTOMATION TESTING WITH CUCUMBER 19
  • 20. BDD Automation Test with Cucumber BDD AUTOMATION TESTING WITH CUCUMBER 20
  • 21. Example of BDD scenario: Feature: login to the system. Asa user, I want to login into the system when I provide username and password. Scenario:login successfully Giventhe login page is opening WhenI input username into the username textbox AndI input valid password into the password textbox AndI click Login button ThenI am on the Home page BDD AUTOMATION TESTING WITH CUCUMBER 21
  • 22. BDD Scenario with parameters: BDD AUTOMATION TESTING WITH CUCUMBER 22
  • 23. How Cucumber works: BDD AUTOMATION TESTING WITH CUCUMBER Given/^I launch "([^"]*)" page$/ do |page| visit(page) End When/^I fill in "([^"]*)" with "([^"]*)"$/ do |field, value| fill_infield, :with => value end 23
  • 24. BDD scenario with multi dataset: BDD AUTOMATION TESTING WITH CUCUMBER 24
  • 25. Cucumber Live Demo BDD AUTOMATION TESTING WITH CUCUMBER 25
  • 26. Environment setup: •Windows: –Install Ruby Installer •Download: http://rubyinstaller.org/downloads[Ruby 1.9.3-p125] •Install: rubyinstaller-xxx.exe •Verify: gem –Install Ruby DevKit •Download: http://rubyinstaller.org/downloads[DevKit-tdm-32- xxx] •Run: DevKit-tdm-32-xxx.exe •Generate config.ymlfile: ruby dk.rbinit •Install DevKit: ruby dk.rb •Test Installation:gem install rdiscount--platform=ruby BDD AUTOMATION TESTING WITH CUCUMBER 26
  • 27. Q&A BDD AUTOMATION TESTING WITH CUCUMBER 27
  • 28. THANK YOU © 2013 KMS Technology
  • 29. APPENDIX APPENDIX –PAGE OBJECT PATTERN 29
  • 30. UI Test Setup with Page Object Pattern APPENDIX –PAGE OBJECT PATTERN 30
  • 31. PAGEOBJECTPATTERN Page Object Pattern is UI Automation Test good practice. It represents the screens of Web app as a series of objects and encapsulates the features represented by a page. It allows us to model the UI in our tests. A page object is an object-oriented class that serves as an interface to a page of your AUT. APPENDIX –PAGE OBJECT PATTERN 31
  • 32. Page Object Pattern advantages: Reduces the duplication of code Makes tests more readable and robust Improves themaintainabilityof tests, particularly when there is frequent change in the AUT.(Useful in Agile methodology based projects) APPENDIX –PAGE OBJECT PATTERN 32
  • 33. Cucumber Live Demo with Page Object Pattern APPENDIX –PAGE OBJECT PATTERN 33
  • 34. References •Spring + Behavior-Driven-Development •Cukes.info •The Cucumber Book •Page Object Pattern BDD AUTOMATION TESTING WITH CUCUMBER 34