SlideShare a Scribd company logo
1 of 14
Cucumber
What it is
Straight-forward language
   Common Language
   Communication Tool
   Concrete Examples
   Describes behavior
Behavior Driven
 Development (BDD)

first: describe what the software does

second: write the code to fulfill it

(behavior drives development)
BDD


Separate software design (one job)

from

writing code (a different job)
Cucumber

software for BDD

that takes plain english,

Ruby translations of plain english,

and runs integration test/stories against your
application
Cucumber’s Natural Habitat
Features
 Features               Plain text
               Filename ends in .feature
              Describes behavior of system
               Lives in features directory

  Step
   Step                        Ruby code
Definitions
Definitions               Filename ends in.rb
              Does regex match of text from feature files
               Lives in features/step_definition directory


Ruby Magic
Ruby Magic        Your preferred gems go here
              Referenced in features/support/env.rb




Application
Application    We will be testing a web-page
Under Test
Under Test
Cucumber - Example
Cucumber benefits
it facilitates thinking about features and
problems in the language of business rather
than the language of code

it requires you to focus on data in your tests

it can be easily included in a continuous
integration environment

it is easily shared with non-developer users

Easy re-factor with confidence
Recap -- Features
•   Plain text files that end in .feature
•   They live in the root of the features directory
•   Given, When, Then, And, But are trigger words
•   They matter most for readability
•   Descriptive text can go at the top
•   There are several approaches to abstract features and
    make them more readable
•   Usage depends on intent & team understanding
Recap -- Step Definitions
•   Ruby files that live in features/step_definitions
•   Matches plain text from feature files
•   Stores it into a variable
•   You can set this to a class level variable for use across
    your test scenario
•   Use a gem to get where you need to go (e.g. Capybara for
    web testing)
Recap -- System Setup
•   Gems you want to use can be added to env.rb
•   It lives in the features/support directory
•   If/when you create helper methods, create a ruby file and
    place them in this directory
•   If you add something to your test harness and execution
    order is important, place it in env.rb – it loads before
    everything else
Cucumber: Let’s use it!



End of presentation--now to the terminal.

More Related Content

What's hot

Indroduction to Web Application
Indroduction to Web ApplicationIndroduction to Web Application
Indroduction to Web Applicationtorny10
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakSigma Software
 
Day 1 - Intro to Ruby
Day 1 - Intro to RubyDay 1 - Intro to Ruby
Day 1 - Intro to RubyBarry Jones
 
A brief intro to RubyMotion
A brief intro to RubyMotionA brief intro to RubyMotion
A brief intro to RubyMotionKamil Lelonek
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecturejuly mon
 

What's hot (10)

Crystal
CrystalCrystal
Crystal
 
Indroduction to Web Application
Indroduction to Web ApplicationIndroduction to Web Application
Indroduction to Web Application
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr Sugak
 
Functional solid
Functional solidFunctional solid
Functional solid
 
Scala vs ruby
Scala vs rubyScala vs ruby
Scala vs ruby
 
Cloud Orchestration is Broken
Cloud Orchestration is BrokenCloud Orchestration is Broken
Cloud Orchestration is Broken
 
Day 1 - Intro to Ruby
Day 1 - Intro to RubyDay 1 - Intro to Ruby
Day 1 - Intro to Ruby
 
A brief intro to RubyMotion
A brief intro to RubyMotionA brief intro to RubyMotion
A brief intro to RubyMotion
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
easyM2R
easyM2ReasyM2R
easyM2R
 

Similar to Cucumber

Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystemGeison Goes
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Muhammad Haseeb Shahid
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorialsunniboy
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Railsmithunsasidharan
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189Mahmoud Samir Fayed
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroadJim Jones
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoadwebuploader
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Espen Brækken
 
Agile DSL Development in Ruby
Agile DSL Development in RubyAgile DSL Development in Ruby
Agile DSL Development in Rubyelliando dias
 
Modern web dev_taxonomy
Modern web dev_taxonomyModern web dev_taxonomy
Modern web dev_taxonomykevin_donovan
 
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Katy Slemon
 

Similar to Cucumber (20)

Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
sl slides-unit-1.pptx
sl slides-unit-1.pptxsl slides-unit-1.pptx
sl slides-unit-1.pptx
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystem
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
 
cucumber harpal.pdf
cucumber harpal.pdfcucumber harpal.pdf
cucumber harpal.pdf
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
ruby pentest
ruby pentestruby pentest
ruby pentest
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
 
Ruby on rails for beginers
Ruby on rails for beginersRuby on rails for beginers
Ruby on rails for beginers
 
Agile DSL Development in Ruby
Agile DSL Development in RubyAgile DSL Development in Ruby
Agile DSL Development in Ruby
 
BDD with Cucumber
BDD with CucumberBDD with Cucumber
BDD with Cucumber
 
Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)
 
Cucumber presenation
Cucumber presenationCucumber presenation
Cucumber presenation
 
Modern web dev_taxonomy
Modern web dev_taxonomyModern web dev_taxonomy
Modern web dev_taxonomy
 
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
 

Cucumber

  • 2.
  • 3. What it is Straight-forward language Common Language Communication Tool Concrete Examples Describes behavior
  • 4. Behavior Driven Development (BDD) first: describe what the software does second: write the code to fulfill it (behavior drives development)
  • 5. BDD Separate software design (one job) from writing code (a different job)
  • 6. Cucumber software for BDD that takes plain english, Ruby translations of plain english, and runs integration test/stories against your application
  • 8. Features Features Plain text Filename ends in .feature Describes behavior of system Lives in features directory Step Step Ruby code Definitions Definitions Filename ends in.rb Does regex match of text from feature files Lives in features/step_definition directory Ruby Magic Ruby Magic Your preferred gems go here Referenced in features/support/env.rb Application Application We will be testing a web-page Under Test Under Test
  • 10. Cucumber benefits it facilitates thinking about features and problems in the language of business rather than the language of code it requires you to focus on data in your tests it can be easily included in a continuous integration environment it is easily shared with non-developer users Easy re-factor with confidence
  • 11. Recap -- Features • Plain text files that end in .feature • They live in the root of the features directory • Given, When, Then, And, But are trigger words • They matter most for readability • Descriptive text can go at the top • There are several approaches to abstract features and make them more readable • Usage depends on intent & team understanding
  • 12. Recap -- Step Definitions • Ruby files that live in features/step_definitions • Matches plain text from feature files • Stores it into a variable • You can set this to a class level variable for use across your test scenario • Use a gem to get where you need to go (e.g. Capybara for web testing)
  • 13. Recap -- System Setup • Gems you want to use can be added to env.rb • It lives in the features/support directory • If/when you create helper methods, create a ruby file and place them in this directory • If you add something to your test harness and execution order is important, place it in env.rb – it loads before everything else
  • 14. Cucumber: Let’s use it! End of presentation--now to the terminal.

Editor's Notes

  1. #1 – in this case, English #2 A common language between the business and the tech team Helping you understand better what needs to be built And, helps the business better understand what you are building #3 Cucumber is a communication tool more than anything – automation is just a secondary benefit #4 Examples are powerful stuff They have the power to turn high-level acceptance criteria into specific & actionable acceptance tests (either to be carried out manually, or, with automation) They also engage our brains enabling us to visualize scenarios & figure out edge cases we may otherwise miss #5 This is all buttressed by the idea of describing the behavior of an application you are hoping to verify
  2. Okay, let’s change gears and step through the mechanics of Cucumber Cucumber uses Gherkin which is a universal To be clear -- Gherkin can be used in other BDD frameworks that use other programming languages For our purposes, we’ll be using Cucumber & Ruby So, in Cucumber, there is a default folder structure – let’s step through it