SlideShare une entreprise Scribd logo
1  sur  11
CUCUMBER
A high level, integration testing framework
• Testing   the entire stack

• Designed    to create applications via BDD

• Define     behavior in plain english, not "code"
WORK FLOW


1. Feature - integration test

2. Spec - unit test

3. Code
FEATURES

Feature... name

  In order... goal

  As a... role

  I want... action
FEATURES
# manage_articles.feature

Feature: Manage Articles

 In order to make a blog

 As an author

 I want to create articles
SCENARIOS
Scenario... name

  Given... setup

  When... exercise

  Then... test
SCENARIOS
# manage_articles.feature

Scenario: Articles List

 Given I have articles titled Pizza, Breadsticks

 When I go to the list of articles

 Then I should see "Pizza"

 And I should see "Breadsticks"
STEPS
# manage_articles_steps.rb

Given /^I have articles titled (.+)$/ do |titles|

  titles.split(', ').each do |title|

      Article.create!(:title => title)

  end

end
PATHS
# paths.rb

# When I go to the list of articles

def path_to(page_name)

  case page_name

  when /the list of articles/

      articles_path

  end

end
BACKGROUND
# manage_articles.feature

Background:
  Given the following user records

    | username | password | admin |
    | bob      | secret     | false |

    | admin    | secret     | true   |
Scenario: Protect articles from regular users

   Given I am logged in as "bob"
   When I visit the list of articles

   And I press "Delete all"
   Then I should see "Sorry you cannot do that"

Scenario: Delete articles as admin
   Given I am logged in as "bob"

   When I visit the list of articles
   And I press "Delete all"

   Then I should see "Articles deleted”
RESOURCES


• http://cuckes.info

• http://wiki.github.com/brynary/webrat

• http://rubular.com

• http://ianwhite.github.com/pickle/

Contenu connexe

Tendances

Integrating Browserify with Sprockets
Integrating Browserify with SprocketsIntegrating Browserify with Sprockets
Integrating Browserify with Sprockets
Spike Brehm
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Joey Kudish
 
<img src="../i/r_14.png" />
<img src="../i/r_14.png" /><img src="../i/r_14.png" />
<img src="../i/r_14.png" />
tutorialsruby
 

Tendances (14)

BBUI
BBUIBBUI
BBUI
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
JavaScript on Rails 튜토리얼
JavaScript on Rails 튜토리얼JavaScript on Rails 튜토리얼
JavaScript on Rails 튜토리얼
 
Theming Wordpress with Adobe
Theming Wordpress with AdobeTheming Wordpress with Adobe
Theming Wordpress with Adobe
 
Integrating Browserify with Sprockets
Integrating Browserify with SprocketsIntegrating Browserify with Sprockets
Integrating Browserify with Sprockets
 
An introduction to jQuery
An introduction to jQueryAn introduction to jQuery
An introduction to jQuery
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
 
BDD in Drupal 8 Using Behat, mink and Selenium
BDD in Drupal 8 Using Behat, mink and SeleniumBDD in Drupal 8 Using Behat, mink and Selenium
BDD in Drupal 8 Using Behat, mink and Selenium
 
Browserify
BrowserifyBrowserify
Browserify
 
How to driver your webservices with ansible
How to driver your webservices with ansibleHow to driver your webservices with ansible
How to driver your webservices with ansible
 
<img src="../i/r_14.png" />
<img src="../i/r_14.png" /><img src="../i/r_14.png" />
<img src="../i/r_14.png" />
 
Lightning Talk: Making JS better with Browserify
Lightning Talk: Making JS better with BrowserifyLightning Talk: Making JS better with Browserify
Lightning Talk: Making JS better with Browserify
 
Rails3 asset-pipeline
Rails3 asset-pipelineRails3 asset-pipeline
Rails3 asset-pipeline
 
WordPress Theme Workshop: CSS/JS
WordPress Theme Workshop: CSS/JSWordPress Theme Workshop: CSS/JS
WordPress Theme Workshop: CSS/JS
 

En vedette

School Presentation Szkoła Podstawowa nr 6 im. Janusza Korczaka
School Presentation Szkoła Podstawowa nr 6 im. Janusza KorczakaSchool Presentation Szkoła Podstawowa nr 6 im. Janusza Korczaka
School Presentation Szkoła Podstawowa nr 6 im. Janusza Korczaka
Tiina Sarisalmi
 
Amia Chi Citizen Public Health V2
Amia Chi Citizen Public Health V2Amia Chi Citizen Public Health V2
Amia Chi Citizen Public Health V2
bonander
 
Digital Trends Impacting News Companies
Digital Trends Impacting News CompaniesDigital Trends Impacting News Companies
Digital Trends Impacting News Companies
Reid Williams
 
Christmas Handicraft by Thanasis
Christmas Handicraft by ThanasisChristmas Handicraft by Thanasis
Christmas Handicraft by Thanasis
Tiina Sarisalmi
 
Lunch Menus and Recipes from Portugal
Lunch Menus and Recipes from PortugalLunch Menus and Recipes from Portugal
Lunch Menus and Recipes from Portugal
Tiina Sarisalmi
 
Copyright and Fair Use for USU Extension
Copyright and Fair Use for USU ExtensionCopyright and Fair Use for USU Extension
Copyright and Fair Use for USU Extension
Britt Fagerheim
 
Copyright: Regional Campuses and Distance Education
Copyright: Regional Campuses and Distance EducationCopyright: Regional Campuses and Distance Education
Copyright: Regional Campuses and Distance Education
Britt Fagerheim
 
SEO pro manažery
SEO pro manažerySEO pro manažery
SEO pro manažery
vaclav.lohr
 
Personagraph Whitepaper
Personagraph WhitepaperPersonagraph Whitepaper
Personagraph Whitepaper
Tapan Kamdar
 

En vedette (20)

All Objects are created .equal?
All Objects are created .equal?All Objects are created .equal?
All Objects are created .equal?
 
plaY [commercial]
plaY [commercial]plaY [commercial]
plaY [commercial]
 
WELD, Why, Content Marketing & Gamification
WELD, Why, Content Marketing & GamificationWELD, Why, Content Marketing & Gamification
WELD, Why, Content Marketing & Gamification
 
School Presentation Szkoła Podstawowa nr 6 im. Janusza Korczaka
School Presentation Szkoła Podstawowa nr 6 im. Janusza KorczakaSchool Presentation Szkoła Podstawowa nr 6 im. Janusza Korczaka
School Presentation Szkoła Podstawowa nr 6 im. Janusza Korczaka
 
Amia Chi Citizen Public Health V2
Amia Chi Citizen Public Health V2Amia Chi Citizen Public Health V2
Amia Chi Citizen Public Health V2
 
Digital Trends Impacting News Companies
Digital Trends Impacting News CompaniesDigital Trends Impacting News Companies
Digital Trends Impacting News Companies
 
Christmas Handicraft by Thanasis
Christmas Handicraft by ThanasisChristmas Handicraft by Thanasis
Christmas Handicraft by Thanasis
 
Lunch Menus and Recipes from Portugal
Lunch Menus and Recipes from PortugalLunch Menus and Recipes from Portugal
Lunch Menus and Recipes from Portugal
 
plaY [pera]
plaY [pera]plaY [pera]
plaY [pera]
 
Our School in Turkey
Our School in TurkeyOur School in Turkey
Our School in Turkey
 
Relief 2.0 in Japan (Japanese Version)
Relief 2.0 in Japan (Japanese Version)Relief 2.0 in Japan (Japanese Version)
Relief 2.0 in Japan (Japanese Version)
 
Credentials - ways2engage
Credentials - ways2engageCredentials - ways2engage
Credentials - ways2engage
 
Copyright and Fair Use for USU Extension
Copyright and Fair Use for USU ExtensionCopyright and Fair Use for USU Extension
Copyright and Fair Use for USU Extension
 
Double Trouble
Double TroubleDouble Trouble
Double Trouble
 
Matias Perez Garate
Matias Perez GarateMatias Perez Garate
Matias Perez Garate
 
Copyright: Regional Campuses and Distance Education
Copyright: Regional Campuses and Distance EducationCopyright: Regional Campuses and Distance Education
Copyright: Regional Campuses and Distance Education
 
SEO pro manažery
SEO pro manažerySEO pro manažery
SEO pro manažery
 
The vmware story
The vmware storyThe vmware story
The vmware story
 
CoreyGerovac
CoreyGerovacCoreyGerovac
CoreyGerovac
 
Personagraph Whitepaper
Personagraph WhitepaperPersonagraph Whitepaper
Personagraph Whitepaper
 

Similaire à Cucumber

UPenn on Rails pt 2
UPenn on Rails pt 2UPenn on Rails pt 2
UPenn on Rails pt 2
Mat Schaffer
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launched
Mat Schaffer
 
PTW Rails Bootcamp
PTW Rails BootcampPTW Rails Bootcamp
PTW Rails Bootcamp
Mat Schaffer
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 

Similaire à Cucumber (20)

Pourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirent
 
Introduction à Ruby
Introduction à RubyIntroduction à Ruby
Introduction à Ruby
 
Cucumber & BDD
Cucumber & BDDCucumber & BDD
Cucumber & BDD
 
UPenn on Rails pt 2
UPenn on Rails pt 2UPenn on Rails pt 2
UPenn on Rails pt 2
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launched
 
PTW Rails Bootcamp
PTW Rails BootcampPTW Rails Bootcamp
PTW Rails Bootcamp
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
 
Rails 3 (beta) Roundup
Rails 3 (beta) RoundupRails 3 (beta) Roundup
Rails 3 (beta) Roundup
 
BDD, Behat & Drupal
BDD, Behat & DrupalBDD, Behat & Drupal
BDD, Behat & Drupal
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - Introduction
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
 
Test legacy apps with Behat
Test legacy apps with BehatTest legacy apps with Behat
Test legacy apps with Behat
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Transformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicaçãoTransformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicação
 
Rails vu d'un Javaiste
Rails vu d'un JavaisteRails vu d'un Javaiste
Rails vu d'un Javaiste
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Ruby/Rails
Ruby/RailsRuby/Rails
Ruby/Rails
 
The Dark Art of Rails Plugins (2008)
The Dark Art of Rails Plugins (2008)The Dark Art of Rails Plugins (2008)
The Dark Art of Rails Plugins (2008)
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
 
Associations & JavaScript
Associations & JavaScriptAssociations & JavaScript
Associations & JavaScript
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Cucumber

Notes de l'éditeur

  1. (possibly even javascript or flash) (to later be interpreted into ruby)
  2. Scenario is made up of many steps, defined with regex
  3. Scenario is made up of many steps, defined with regex
  4. Cucumber provides prewritten steps (webrat.steps)
  5. translate plain english into a resource path (URL) with regex
  6. Steps that will be run for all scenarios in a feature