SlideShare a Scribd company logo
1 of 34
Download to read offline
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

What's hot (20)

Cypress e2e automation testing - day1 intor by: Hassan Hameed
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan Hameed
 
Introduction to Bdd and cucumber
Introduction to Bdd and cucumberIntroduction to Bdd and cucumber
Introduction to Bdd and cucumber
 
Gherkin /BDD intro
Gherkin /BDD introGherkin /BDD intro
Gherkin /BDD intro
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentation
 
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. SeleniumQA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
 
Cucumber BDD
Cucumber BDDCucumber BDD
Cucumber BDD
 
Cypress - Best Practices
Cypress - Best PracticesCypress - Best Practices
Cypress - Best Practices
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
 
Testing in Agile Projects
Testing in Agile ProjectsTesting in Agile Projects
Testing in Agile Projects
 
Selenium with Cucumber
Selenium  with Cucumber Selenium  with Cucumber
Selenium with Cucumber
 
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarCypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
 
Cucumber & gherkin language
Cucumber & gherkin languageCucumber & gherkin language
Cucumber & gherkin language
 
QA Best Practices in Agile World_new
QA Best Practices in Agile World_newQA Best Practices in Agile World_new
QA Best Practices in Agile World_new
 
BDD Approach with Karate Framework in Service Tests
BDD Approach with Karate Framework in Service TestsBDD Approach with Karate Framework in Service Tests
BDD Approach with Karate Framework in Service Tests
 
Behavior driven development (bdd)
Behavior driven development (bdd)Behavior driven development (bdd)
Behavior driven development (bdd)
 
Automated Test Framework with Cucumber
Automated Test Framework with CucumberAutomated Test Framework with Cucumber
Automated Test Framework with Cucumber
 
Agile Testing and Test Automation
Agile Testing and Test AutomationAgile Testing and Test Automation
Agile Testing and Test Automation
 
Introduction to BDD
Introduction to BDDIntroduction to BDD
Introduction to BDD
 
Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
 

Viewers also liked

Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
Brandon Keepers
 
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイルTrac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Shuji Watanabe
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationSmarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 

Viewers also liked (20)

Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 
BBD Hands-on with Python. Practical Hands-on Workshop about "Behaviour Driven...
BBD Hands-on with Python. Practical Hands-on Workshop about "Behaviour Driven...BBD Hands-on with Python. Practical Hands-on Workshop about "Behaviour Driven...
BBD Hands-on with Python. Practical Hands-on Workshop about "Behaviour Driven...
 
Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...Bridging the gap between business and technology - Behaviour Driven Developme...
Bridging the gap between business and technology - Behaviour Driven Developme...
 
Making Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI AutomationMaking Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI Automation
 
Selenium Camp 2016
Selenium Camp 2016Selenium Camp 2016
Selenium Camp 2016
 
Selenium
SeleniumSelenium
Selenium
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイルTrac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
 
Protractor overview
Protractor overviewProtractor overview
Protractor overview
 
Protractor training
Protractor trainingProtractor training
Protractor training
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJS
 
Product Owner Challenge - User Stories ready to play
Product Owner Challenge - User Stories ready to playProduct Owner Challenge - User Stories ready to play
Product Owner Challenge - User Stories ready to play
 
Ant, Maven and Jenkins
Ant, Maven and JenkinsAnt, Maven and Jenkins
Ant, Maven and Jenkins
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and Selenium
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 
Product Owner Challenge game
Product Owner Challenge game Product Owner Challenge game
Product Owner Challenge game
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Continuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And DockerContinuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And Docker
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationSmarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automation
 

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

Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
elliando dias
 

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

Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
Cucumber_Training_ForQA
Cucumber_Training_ForQACucumber_Training_ForQA
Cucumber_Training_ForQA
 
Continous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and JenkinsContinous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and Jenkins
 
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Ci/CD - Stop wasting time, Automate your deployments
Ci/CD  - Stop wasting time, Automate your deploymentsCi/CD  - Stop wasting time, Automate your deployments
Ci/CD - Stop wasting time, Automate your deployments
 
Test Automation using Ruby
Test Automation using Ruby Test Automation using Ruby
Test Automation using Ruby
 
Kubernetes best practices
Kubernetes best practicesKubernetes best practices
Kubernetes best practices
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
 
Automated browser testing
Automated browser testingAutomated browser testing
Automated browser testing
 
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
 
Cypress test techniques cucumber bdd framework,tdd,api tests course
Cypress test techniques cucumber bdd framework,tdd,api tests courseCypress test techniques cucumber bdd framework,tdd,api tests course
Cypress test techniques cucumber bdd framework,tdd,api tests course
 
Automated CI with AEM Cloud service
Automated CI with AEM Cloud serviceAutomated CI with AEM Cloud service
Automated CI with AEM Cloud service
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
 

More from KMS Technology

Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
KMS Technology
 
Technology Application Development Trends For IT Students
Technology Application Development Trends For IT StudentsTechnology Application Development Trends For IT Students
Technology Application Development Trends For IT Students
KMS Technology
 

More from KMS Technology (20)

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

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Behavior-Driven Development and Automation Testing Using Cucumber Framework Webinar

  • 1. Behavior-Driven Developmentand Automation Testing using Cucumber Framework. TrongBui KMS-Technologytrongbui@kms-technology.comhttp://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("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
  • 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