SlideShare a Scribd company logo
by IntekhabSadekin CUCUMBER –Making BDD Fun
Question: One of main constituents of a salad? Answer: SURE!!! But that’s not what we are here for!!! What is Cucumber?
Behavior Driven Development and testing tool Bunch of behaviors in the form of scenarios Written mainly by non-technical people Written in plain english What is Cucumber actually?
Write a behavior in the form of scenario in a feature file Write the code in order to satisfy the scenario(the actual application and not the automation script) Run the feature file Watch it fail Write the automation script with the template provided by cucumber The behavior of the application is satisfied by the test script What should you actually do?
I am sorry but I am not going to discuss the merits and demerits of BDD Behavior Driven Development?
Project root/ Features fileName1.feature fileName2.feature Support Env.rb Step_definitions fileName1.rb fileName2.rb Directory structure
Feature: Title As a [role] I want [feature] So that [benefit] Scenario: Title Given [context] When [event] And [more event] Then [outcome] And [another outcome] Lets get straight to it!!!
What the @#$% !!!
Feature: Login As an admin I want be able to login with my credentials So that I get to the home page Scenario: Able to successfully login Given that I am on page “http://www.blahblah.com” When I provide my username “admin” And I provide my password “admin” Then I should be at “HomePage” Example
Develop the application driven by the behavior described earlier in the feature file Develop!!!
$ cucumber login.feature RUN the damn thing….
Run and watch it fail…
A template provided in order to write the automation script
      Given /^I am on "([^amp;quot;]*)"$/ do |url| pending end When /^I enter username "([^amp;quot;]*)"$/ do |userName| pending end When /^I enter password "([^amp;quot;]*)"$/ do |password|    pending end When /^I click the button with name "([^amp;quot;]*)"$/ do |buttonValue|   pending end Then /^I should be at "([^amp;quot;]*)"$/ do |url|  pending end What should I do?
They are called step definitions Essentially bunch of ruby code A library called Watir is used for the API What was that?
Run it again…. What next….
Watch it fail again…
Given /^I am on "([^amp;quot;]*)"$/ do |url| @browser.goto(url) end When /^I enter username "([^amp;quot;]*)"$/ do |userName|    pending end When /^I enter password "([^amp;quot;]*)"$/ do |password|    pending end When /^I click the button with name "([^amp;quot;]*)"$/ do |buttonValue|   pending end Then /^I should be at "([^amp;quot;]*)"$/ do |url|  pending end Make the necessary changes
Go back to step definitions and write the script in order to satisfy the behavior
Keep on running the feature file until all of them turns green like a Cucumber
? Thank You!!!

More Related Content

What's hot

Cucumber & gherkin language
Cucumber & gherkin languageCucumber & gherkin language
Cucumber & gherkin language
selvanathankapilan
 
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
Ho Chi Minh City Software Testing Club
 
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 CucumberKMS Technology
 
BDD with cucumber
BDD with cucumberBDD with cucumber
BDD with cucumber
Kerry Buckley
 
Implementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using CucumberImplementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using Cucumber
TechWell
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
Asheesh Mehdiratta
 
Writing automation tests with python selenium behave pageobjects
Writing automation tests with python selenium behave pageobjectsWriting automation tests with python selenium behave pageobjects
Writing automation tests with python selenium behave pageobjects
Leticia Rss
 
RSpec User Stories
RSpec User StoriesRSpec User Stories
RSpec User Stories
rahoulb
 
Geb for testing your grails application
Geb for testing your grails applicationGeb for testing your grails application
Geb for testing your grails application
JacobAae
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
Paul Jensen
 
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and PuppeteerE2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
Paul Jensen
 
Introduction to React Native & Redux
Introduction to React Native & ReduxIntroduction to React Native & Redux
Introduction to React Native & Redux
Barak Cohen
 
Ryan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was GoodRyan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was Good
FITC
 
Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)
Mindfire Solutions
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot Overlords
Steve Malsam
 
Teaching an Old Pony New Tricks: Maintaining and Updating and Aging Django Site
Teaching an Old Pony New Tricks: Maintaining and Updating and Aging Django SiteTeaching an Old Pony New Tricks: Maintaining and Updating and Aging Django Site
Teaching an Old Pony New Tricks: Maintaining and Updating and Aging Django Site
Shawn Rider
 
I18n
I18nI18n
I18nsoon
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
Dougal Campbell
 
Calabash for iPhone apps
Calabash for iPhone appsCalabash for iPhone apps
Calabash for iPhone apps
Chathura palihakkara
 
Modern Functional Fluent ColdFusion REST Apis
Modern Functional Fluent ColdFusion REST ApisModern Functional Fluent ColdFusion REST Apis
Modern Functional Fluent ColdFusion REST Apis
Ortus Solutions, Corp
 

What's hot (20)

Cucumber & gherkin language
Cucumber & gherkin languageCucumber & gherkin language
Cucumber & gherkin language
 
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
 
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
 
BDD with cucumber
BDD with cucumberBDD with cucumber
BDD with cucumber
 
Implementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using CucumberImplementing Testing for Behavior-Driven Development Using Cucumber
Implementing Testing for Behavior-Driven Development Using Cucumber
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 
Writing automation tests with python selenium behave pageobjects
Writing automation tests with python selenium behave pageobjectsWriting automation tests with python selenium behave pageobjects
Writing automation tests with python selenium behave pageobjects
 
RSpec User Stories
RSpec User StoriesRSpec User Stories
RSpec User Stories
 
Geb for testing your grails application
Geb for testing your grails applicationGeb for testing your grails application
Geb for testing your grails application
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and PuppeteerE2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
E2E testing Single Page Apps and APIs with Cucumber.js and Puppeteer
 
Introduction to React Native & Redux
Introduction to React Native & ReduxIntroduction to React Native & Redux
Introduction to React Native & Redux
 
Ryan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was GoodRyan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was Good
 
Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot Overlords
 
Teaching an Old Pony New Tricks: Maintaining and Updating and Aging Django Site
Teaching an Old Pony New Tricks: Maintaining and Updating and Aging Django SiteTeaching an Old Pony New Tricks: Maintaining and Updating and Aging Django Site
Teaching an Old Pony New Tricks: Maintaining and Updating and Aging Django Site
 
I18n
I18nI18n
I18n
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
 
Calabash for iPhone apps
Calabash for iPhone appsCalabash for iPhone apps
Calabash for iPhone apps
 
Modern Functional Fluent ColdFusion REST Apis
Modern Functional Fluent ColdFusion REST ApisModern Functional Fluent ColdFusion REST Apis
Modern Functional Fluent ColdFusion REST Apis
 

Similar to CUCUMBER - Making BDD Fun

Cucumber & BDD
Cucumber & BDDCucumber & BDD
Cucumber & BDD
Sam Davarnia
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
Berend de Boer
 
BDD / cucumber /Capybara
BDD / cucumber /CapybaraBDD / cucumber /Capybara
BDD / cucumber /Capybara
ShraddhaSF
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Updimakovalenko
 
Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011
dimakovalenko
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
Ben Mabey
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
Lindsay Holmwood
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
Mike Desjardins
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
Andy Kelk
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Jean-Loup Yu
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
jQuery Presentation - Refresh Events
jQuery Presentation - Refresh EventsjQuery Presentation - Refresh Events
jQuery Presentation - Refresh Events
Eugene Andruszczenko
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Tikal Knowledge
 
Apache Ant
Apache AntApache Ant
Apache Ant
hussulinux
 
Cucumber: How I Slice It
Cucumber: How I Slice ItCucumber: How I Slice It
Cucumber: How I Slice It
linoj
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Rebecca Eloise Hogg
 
Smarter Interfaces with jQuery (and Drupal)
Smarter Interfaces with jQuery (and Drupal)Smarter Interfaces with jQuery (and Drupal)
Smarter Interfaces with jQuery (and Drupal)
aasarava
 
Using Ruby in Android Development
Using Ruby in Android DevelopmentUsing Ruby in Android Development
Using Ruby in Android Development
Adam Blum
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
Saket Choudhary
 

Similar to CUCUMBER - Making BDD Fun (20)

Cucumber & BDD
Cucumber & BDDCucumber & BDD
Cucumber & BDD
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
 
BDD / cucumber /Capybara
BDD / cucumber /CapybaraBDD / cucumber /Capybara
BDD / cucumber /Capybara
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
 
Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
 
jQuery Presentation - Refresh Events
jQuery Presentation - Refresh EventsjQuery Presentation - Refresh Events
jQuery Presentation - Refresh Events
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Cucumber: How I Slice It
Cucumber: How I Slice ItCucumber: How I Slice It
Cucumber: How I Slice It
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
 
Smarter Interfaces with jQuery (and Drupal)
Smarter Interfaces with jQuery (and Drupal)Smarter Interfaces with jQuery (and Drupal)
Smarter Interfaces with jQuery (and Drupal)
 
Using Ruby in Android Development
Using Ruby in Android DevelopmentUsing Ruby in Android Development
Using Ruby in Android Development
 
Introduce Django
Introduce DjangoIntroduce Django
Introduce Django
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
 

More from SQABD

Hasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery PluginHasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery Plugin
SQABD
 
Shoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission SystemShoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission System
SQABD
 
Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...
Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...
Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...
SQABD
 
Zahidul: Meta Testing
Zahidul: Meta TestingZahidul: Meta Testing
Zahidul: Meta Testing
SQABD
 
Rabbi: Good to Great
Rabbi: Good to GreatRabbi: Good to Great
Rabbi: Good to Great
SQABD
 
Imrul: Context Driven Testing
Imrul: Context Driven TestingImrul: Context Driven Testing
Imrul: Context Driven Testing
SQABD
 
Tauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationTauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change Automation
SQABD
 
Ayman: When to stop testing?
Ayman: When to stop testing?Ayman: When to stop testing?
Ayman: When to stop testing?
SQABD
 
Mozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro TechniqueMozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro Technique
SQABD
 
Hasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate codeHasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate codeSQABD
 
Kabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkeyKabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkeySQABD
 
Mozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content trackerMozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content trackerSQABD
 
M. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA EmpowermentM. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA EmpowermentSQABD
 
Shimul: Testing Mnemonics
Shimul: Testing MnemonicsShimul: Testing Mnemonics
Shimul: Testing Mnemonics
SQABD
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: SeleniumSQABD
 
Jan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi ExperienceJan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi ExperienceSQABD
 
Hasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of itHasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of itSQABD
 
Mozammel Haque: Scrum
Mozammel Haque: ScrumMozammel Haque: Scrum
Mozammel Haque: ScrumSQABD
 
Innovation Stories of Test Toolsmiths
Innovation Stories of Test ToolsmithsInnovation Stories of Test Toolsmiths
Innovation Stories of Test Toolsmiths
SQABD
 
Code Review In Testing View
Code Review In Testing ViewCode Review In Testing View
Code Review In Testing View
SQABD
 

More from SQABD (20)

Hasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery PluginHasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery Plugin
 
Shoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission SystemShoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission System
 
Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...
Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...
Aman: Developing a lightweight, hi-performance and dynamic JSON api server wi...
 
Zahidul: Meta Testing
Zahidul: Meta TestingZahidul: Meta Testing
Zahidul: Meta Testing
 
Rabbi: Good to Great
Rabbi: Good to GreatRabbi: Good to Great
Rabbi: Good to Great
 
Imrul: Context Driven Testing
Imrul: Context Driven TestingImrul: Context Driven Testing
Imrul: Context Driven Testing
 
Tauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationTauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change Automation
 
Ayman: When to stop testing?
Ayman: When to stop testing?Ayman: When to stop testing?
Ayman: When to stop testing?
 
Mozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro TechniqueMozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro Technique
 
Hasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate codeHasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate code
 
Kabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkeyKabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkey
 
Mozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content trackerMozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content tracker
 
M. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA EmpowermentM. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA Empowerment
 
Shimul: Testing Mnemonics
Shimul: Testing MnemonicsShimul: Testing Mnemonics
Shimul: Testing Mnemonics
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: Selenium
 
Jan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi ExperienceJan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi Experience
 
Hasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of itHasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of it
 
Mozammel Haque: Scrum
Mozammel Haque: ScrumMozammel Haque: Scrum
Mozammel Haque: Scrum
 
Innovation Stories of Test Toolsmiths
Innovation Stories of Test ToolsmithsInnovation Stories of Test Toolsmiths
Innovation Stories of Test Toolsmiths
 
Code Review In Testing View
Code Review In Testing ViewCode Review In Testing View
Code Review In Testing View
 

CUCUMBER - Making BDD Fun

  • 1. by IntekhabSadekin CUCUMBER –Making BDD Fun
  • 2. Question: One of main constituents of a salad? Answer: SURE!!! But that’s not what we are here for!!! What is Cucumber?
  • 3. Behavior Driven Development and testing tool Bunch of behaviors in the form of scenarios Written mainly by non-technical people Written in plain english What is Cucumber actually?
  • 4. Write a behavior in the form of scenario in a feature file Write the code in order to satisfy the scenario(the actual application and not the automation script) Run the feature file Watch it fail Write the automation script with the template provided by cucumber The behavior of the application is satisfied by the test script What should you actually do?
  • 5. I am sorry but I am not going to discuss the merits and demerits of BDD Behavior Driven Development?
  • 6. Project root/ Features fileName1.feature fileName2.feature Support Env.rb Step_definitions fileName1.rb fileName2.rb Directory structure
  • 7. Feature: Title As a [role] I want [feature] So that [benefit] Scenario: Title Given [context] When [event] And [more event] Then [outcome] And [another outcome] Lets get straight to it!!!
  • 9. Feature: Login As an admin I want be able to login with my credentials So that I get to the home page Scenario: Able to successfully login Given that I am on page “http://www.blahblah.com” When I provide my username “admin” And I provide my password “admin” Then I should be at “HomePage” Example
  • 10. Develop the application driven by the behavior described earlier in the feature file Develop!!!
  • 11. $ cucumber login.feature RUN the damn thing….
  • 12. Run and watch it fail…
  • 13. A template provided in order to write the automation script
  • 14. Given /^I am on "([^amp;quot;]*)"$/ do |url| pending end When /^I enter username "([^amp;quot;]*)"$/ do |userName| pending end When /^I enter password "([^amp;quot;]*)"$/ do |password| pending end When /^I click the button with name "([^amp;quot;]*)"$/ do |buttonValue| pending end Then /^I should be at "([^amp;quot;]*)"$/ do |url| pending end What should I do?
  • 15. They are called step definitions Essentially bunch of ruby code A library called Watir is used for the API What was that?
  • 16. Run it again…. What next….
  • 17. Watch it fail again…
  • 18. Given /^I am on "([^amp;quot;]*)"$/ do |url| @browser.goto(url) end When /^I enter username "([^amp;quot;]*)"$/ do |userName| pending end When /^I enter password "([^amp;quot;]*)"$/ do |password| pending end When /^I click the button with name "([^amp;quot;]*)"$/ do |buttonValue| pending end Then /^I should be at "([^amp;quot;]*)"$/ do |url| pending end Make the necessary changes
  • 19. Go back to step definitions and write the script in order to satisfy the behavior
  • 20. Keep on running the feature file until all of them turns green like a Cucumber
  • 21.