SlideShare una empresa de Scribd logo
1 de 21
presents




                        RELEASE THE GHERKIN!
©2012 AgilityFeat Inc
© 2012 AgilityFeat, Inc.
What it is
•   Straight-forward language
•   Common Language
•   Communication Tool
•   Concrete Examples
•   Describes behavior




                     © 2012 AgilityFeat, Inc.
#protip

“make readability your main goal.
Otherwise, a reader can easily feel more
like they’re a reading computer program
than a specification document”
- Aslak Hellesøy (creator of Cucumber)


                © 2012 AgilityFeat, Inc.
Cucumber’s Natural Habitat




         © 2012 AgilityFeat, Inc.
Features                 Plain text
                         Filename ends in .feature
                         Describes behavior of system
                         Lives in features directory


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


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




Application              We will be testing a web-page
Under Test


              © 2012 AgilityFeat, Inc.
Example
Feature: Brown Bag Demo

Scenario: Google Search
   Given I am on “http://www.google.com”
   When I search for “Hello World”
   Then I should see results containing the search phrase




                      © 2012 AgilityFeat, Inc.
Solution
Given /^I am on “(*^”+*)”$/ do |arg1|
    visit(arg1)
end

When /^I search for “(*^”+*)”$/ do |arg1|
    @search_phrase = arg1
    within(:css, “#gbqfqw”) do
        fill_in ‘q’, :with => @search_phrase
    end
end

Then /^I should see results containing the search phrase$/ do
    page.should have_content(@search_phrase)
end


                                © 2012 AgilityFeat, Inc.
Feature: Class Demonstration

Scenario: Show a Hello World
  Given I want to say “Hello World!”
  When I execute the application
  Then I should see the message




                © 2012 AgilityFeat, Inc.
Feature: Class Demonstration

Scenario: Show a Hello World
  Given I want to say “Hello World!”
  When I execute the application
  Then I should see the message
  And it should be italic
  But it should not be bold



                © 2012 AgilityFeat, Inc.
Feature: Class Demonstration

Scenario: Show a Hello World
  * I want to say “Hello World!”
  * I execute the application
  * I should see the message
  * it should be italic
  * it should not be bold



                © 2012 AgilityFeat, Inc.
Feature: Class Demonstration

Scenario: Show a Hello World
  Given I want to say “Hello World!”
  When I execute the application
  Then I should see the message
  And it should be italic
  But it should not be bold



                © 2012 AgilityFeat, Inc.
Feature: Class Demonstration
In order to expose you to new ideas
As an instructor
I want to show you an end-to-end example

Scenario: Show a Hello World
  Given I want to say “Hello World!”
  When I execute the application
  Then I should see the message
  And it should be italic
  But it should not be bold
                © 2012 AgilityFeat, Inc.
Feature: Class Demonstration
As an instructor
I would like to show an end-to-end example
So that I can expose you to new ideas

Background:
  Given I want to say “Hello World!”
  When I execute the application
  Then I should see the message

Scenario: Show an italicized Hello World
   And it should be italic

Scenario: Show a bold Hello World
   But it should not be2012 AgilityFeat, Inc.
                      ©
                        bold
Feature: International Display

Scenario: Display Hello World in English
   Given I want to say “Hello World!”
   When I execute the application
   And I specify English as the language
   Then the output should be “Hello World!”

Scenario: Display Hello World in Spanish
   Given I want to say “Hello World!”
   When I execute the application
   And I specify Spanish as the language
   Then the output should be “¡Hola, mundo!”

Scenario: Display Hello World in German
   Given I want to say “Hello World!”
   When I execute the application
   And I specify German as the language
   Then the output should © 2012 AgilityFeat, Inc.
                           be “Hallo Welt!”
Feature: Internationalize Hello World

Scenario Outline: Display in multiple languages
   Given I want to say “Hello World!”
   When I execute the application
   And I specify “<language>” as the language
   Then the output should be “<output>”

Examples:
   | language    | output                        |
   | English     | Hello World!                  |
   | Spanish     | ¡Hola, mundo!                 |
   | German      | Hallo Welt!                   |
                      © 2012 AgilityFeat, Inc.
Feature: Travel The World

Scenario: Keep Track Of Visits
  Given a list like this:
  | Location         | Times visited |
  | Costa Rica       |    0          |
  | Germany          |    0          |
  When I travel to Costa Rica
  Then the list should look like this:
  | Location         | Times visited |
  | Costa Rica       |    1          |
  | Germany          |    0          |
                     © 2012 AgilityFeat, Inc.
Doc strings
Scenario: Look up hostel reservation e-mail
When I search for “Alexander House”
Then I should see the following message:
"""
Welcome Mr. Haeffner.
You’ll be staying in the bunk house this visit.
Please refrain from stealing our towels (again).
""”

                    © 2012 AgilityFeat, Inc.
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

                     © 2012 AgilityFeat, Inc.
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)


                       © 2012 AgilityFeat, Inc.
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


                       © 2012 AgilityFeat, Inc.

Más contenido relacionado

Destacado

How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Agile testing for mere mortals
Agile testing for mere mortalsAgile testing for mere mortals
Agile testing for mere mortalsDave Haeffner
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
Selenium Users Anonymous
Selenium Users AnonymousSelenium Users Anonymous
Selenium Users AnonymousDave Haeffner
 
Open Source Investing
Open Source InvestingOpen Source Investing
Open Source InvestingDave Haeffner
 
How To Find Information On Your Own
How To Find Information On Your OwnHow To Find Information On Your Own
How To Find Information On Your OwnDave Haeffner
 
Selenium Tips & Tricks
Selenium Tips & TricksSelenium Tips & Tricks
Selenium Tips & TricksDave Haeffner
 
Agile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) Teaming
Agile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) TeamingAgile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) Teaming
Agile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) TeamingRichard Kasperowski
 
Mobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appiumMobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appiumSelenium Cucumber
 
Zbinden G - paintings
Zbinden G - paintingsZbinden G - paintings
Zbinden G - paintingsartalaferme
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Applitools
 
Awesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerAwesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerSauce Labs
 
Manual snagit grupo A
Manual snagit grupo AManual snagit grupo A
Manual snagit grupo Asasanchezc
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupDave Haeffner
 
Continuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.orgContinuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.orgSauce Labs
 

Destacado (20)

The Testable Web
The Testable WebThe Testable Web
The Testable Web
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Agile testing for mere mortals
Agile testing for mere mortalsAgile testing for mere mortals
Agile testing for mere mortals
 
Selenium Basics
Selenium BasicsSelenium Basics
Selenium Basics
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
Selenium Users Anonymous
Selenium Users AnonymousSelenium Users Anonymous
Selenium Users Anonymous
 
Open Source Investing
Open Source InvestingOpen Source Investing
Open Source Investing
 
Selenium Frameworks
Selenium FrameworksSelenium Frameworks
Selenium Frameworks
 
How To Find Information On Your Own
How To Find Information On Your OwnHow To Find Information On Your Own
How To Find Information On Your Own
 
Selenium Tips & Tricks
Selenium Tips & TricksSelenium Tips & Tricks
Selenium Tips & Tricks
 
Agile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) Teaming
Agile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) TeamingAgile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) Teaming
Agile Arizona 2016 - Awesome Teams: Games for Continuous (Extreme?) Teaming
 
Mobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appiumMobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appium
 
Zbinden G - paintings
Zbinden G - paintingsZbinden G - paintings
Zbinden G - paintings
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
Awesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerAwesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave Haeffner
 
Manual snagit grupo A
Manual snagit grupo AManual snagit grupo A
Manual snagit grupo A
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
 
Ontario Disability Support Program (ODSP) - Know Your Benefits
Ontario Disability Support Program (ODSP) - Know Your BenefitsOntario Disability Support Program (ODSP) - Know Your Benefits
Ontario Disability Support Program (ODSP) - Know Your Benefits
 
Continuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.orgContinuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.org
 

Similar a Cucumber Crash Course

Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven DevelopmentCarsten Nielsen
 
Fukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalFukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalAndy Maleh
 
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014DouglasWaterfall
 
Multi Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoMulti Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoPaul Marden
 
Dynamic Languages In The Enterprise (4developers march 2009)
Dynamic Languages In The Enterprise (4developers march 2009)Dynamic Languages In The Enterprise (4developers march 2009)
Dynamic Languages In The Enterprise (4developers march 2009)Ivo Jansch
 
React Native? A developer's perspective
React Native? A developer's perspectiveReact Native? A developer's perspective
React Native? A developer's perspectiveBorisConforty
 
How to make multilingual plugins and themes
How to make multilingual plugins and themesHow to make multilingual plugins and themes
How to make multilingual plugins and themesjohnpbloch
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Stephan Hochdörfer
 
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...mfrancis
 
How do I - Create a Native Interface - Transcript.pdf
How do I - Create a Native Interface - Transcript.pdfHow do I - Create a Native Interface - Transcript.pdf
How do I - Create a Native Interface - Transcript.pdfShaiAlmog1
 
Object Oriented Views / Aki Salmi
Object Oriented Views / Aki SalmiObject Oriented Views / Aki Salmi
Object Oriented Views / Aki SalmiAki Salmi
 
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 2014Jean-Loup Yu
 
Interference with High level language.pdf
Interference with High level language.pdfInterference with High level language.pdf
Interference with High level language.pdfARslan Ahmad
 
Better problem solving through scripting: How to think through your #eprdctn ...
Better problem solving through scripting: How to think through your #eprdctn ...Better problem solving through scripting: How to think through your #eprdctn ...
Better problem solving through scripting: How to think through your #eprdctn ...BookNet Canada
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps QuicklyGil Irizarry
 
Barcelona Multilanguage
Barcelona MultilanguageBarcelona Multilanguage
Barcelona Multilanguageguest3a6661
 
Building mobile apps with PhoneGap and Titanium appcelerator
Building mobile apps with PhoneGap and Titanium appceleratorBuilding mobile apps with PhoneGap and Titanium appcelerator
Building mobile apps with PhoneGap and Titanium appceleratorChris Ward
 
How to Implement Domain Driven Design in Real Life SDLC
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLCAbdul Karim
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructureLindsay Holmwood
 

Similar a Cucumber Crash Course (20)

Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
Fukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalFukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - Opal
 
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
 
Multi Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoMulti Lingual Websites In Umbraco
Multi Lingual Websites In Umbraco
 
Dynamic Languages In The Enterprise (4developers march 2009)
Dynamic Languages In The Enterprise (4developers march 2009)Dynamic Languages In The Enterprise (4developers march 2009)
Dynamic Languages In The Enterprise (4developers march 2009)
 
React Native? A developer's perspective
React Native? A developer's perspectiveReact Native? A developer's perspective
React Native? A developer's perspective
 
How to make multilingual plugins and themes
How to make multilingual plugins and themesHow to make multilingual plugins and themes
How to make multilingual plugins and themes
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
 
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...
 
How do I - Create a Native Interface - Transcript.pdf
How do I - Create a Native Interface - Transcript.pdfHow do I - Create a Native Interface - Transcript.pdf
How do I - Create a Native Interface - Transcript.pdf
 
Object Oriented Views / Aki Salmi
Object Oriented Views / Aki SalmiObject Oriented Views / Aki Salmi
Object Oriented Views / Aki Salmi
 
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
 
Interference with High level language.pdf
Interference with High level language.pdfInterference with High level language.pdf
Interference with High level language.pdf
 
Better problem solving through scripting: How to think through your #eprdctn ...
Better problem solving through scripting: How to think through your #eprdctn ...Better problem solving through scripting: How to think through your #eprdctn ...
Better problem solving through scripting: How to think through your #eprdctn ...
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps Quickly
 
Barcelona Multilanguage
Barcelona MultilanguageBarcelona Multilanguage
Barcelona Multilanguage
 
Building mobile apps with PhoneGap and Titanium appcelerator
Building mobile apps with PhoneGap and Titanium appceleratorBuilding mobile apps with PhoneGap and Titanium appcelerator
Building mobile apps with PhoneGap and Titanium appcelerator
 
How to Implement Domain Driven Design in Real Life SDLC
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLC
 
Ruby, Meet iPhone
Ruby, Meet iPhoneRuby, Meet iPhone
Ruby, Meet iPhone
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
 

Último

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
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 WoodJuan lago vázquez
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
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...DianaGray10
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
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
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 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...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

Cucumber Crash Course

  • 1. presents RELEASE THE GHERKIN! ©2012 AgilityFeat Inc
  • 3. What it is • Straight-forward language • Common Language • Communication Tool • Concrete Examples • Describes behavior © 2012 AgilityFeat, Inc.
  • 4. #protip “make readability your main goal. Otherwise, a reader can easily feel more like they’re a reading computer program than a specification document” - Aslak Hellesøy (creator of Cucumber) © 2012 AgilityFeat, Inc.
  • 5. Cucumber’s Natural Habitat © 2012 AgilityFeat, Inc.
  • 6. Features Plain text Filename ends in .feature Describes behavior of system Lives in features directory Step Ruby code Definitions Filename ends in.rb Does regex match of text from feature files Lives in features/step_definition directory Ruby Magic Your preferred gems go here Referenced in features/support/env.rb Application We will be testing a web-page Under Test © 2012 AgilityFeat, Inc.
  • 7. Example Feature: Brown Bag Demo Scenario: Google Search Given I am on “http://www.google.com” When I search for “Hello World” Then I should see results containing the search phrase © 2012 AgilityFeat, Inc.
  • 8. Solution Given /^I am on “(*^”+*)”$/ do |arg1| visit(arg1) end When /^I search for “(*^”+*)”$/ do |arg1| @search_phrase = arg1 within(:css, “#gbqfqw”) do fill_in ‘q’, :with => @search_phrase end end Then /^I should see results containing the search phrase$/ do page.should have_content(@search_phrase) end © 2012 AgilityFeat, Inc.
  • 9. Feature: Class Demonstration Scenario: Show a Hello World Given I want to say “Hello World!” When I execute the application Then I should see the message © 2012 AgilityFeat, Inc.
  • 10. Feature: Class Demonstration Scenario: Show a Hello World Given I want to say “Hello World!” When I execute the application Then I should see the message And it should be italic But it should not be bold © 2012 AgilityFeat, Inc.
  • 11. Feature: Class Demonstration Scenario: Show a Hello World * I want to say “Hello World!” * I execute the application * I should see the message * it should be italic * it should not be bold © 2012 AgilityFeat, Inc.
  • 12. Feature: Class Demonstration Scenario: Show a Hello World Given I want to say “Hello World!” When I execute the application Then I should see the message And it should be italic But it should not be bold © 2012 AgilityFeat, Inc.
  • 13. Feature: Class Demonstration In order to expose you to new ideas As an instructor I want to show you an end-to-end example Scenario: Show a Hello World Given I want to say “Hello World!” When I execute the application Then I should see the message And it should be italic But it should not be bold © 2012 AgilityFeat, Inc.
  • 14. Feature: Class Demonstration As an instructor I would like to show an end-to-end example So that I can expose you to new ideas Background: Given I want to say “Hello World!” When I execute the application Then I should see the message Scenario: Show an italicized Hello World And it should be italic Scenario: Show a bold Hello World But it should not be2012 AgilityFeat, Inc. © bold
  • 15. Feature: International Display Scenario: Display Hello World in English Given I want to say “Hello World!” When I execute the application And I specify English as the language Then the output should be “Hello World!” Scenario: Display Hello World in Spanish Given I want to say “Hello World!” When I execute the application And I specify Spanish as the language Then the output should be “¡Hola, mundo!” Scenario: Display Hello World in German Given I want to say “Hello World!” When I execute the application And I specify German as the language Then the output should © 2012 AgilityFeat, Inc. be “Hallo Welt!”
  • 16. Feature: Internationalize Hello World Scenario Outline: Display in multiple languages Given I want to say “Hello World!” When I execute the application And I specify “<language>” as the language Then the output should be “<output>” Examples: | language | output | | English | Hello World! | | Spanish | ¡Hola, mundo! | | German | Hallo Welt! | © 2012 AgilityFeat, Inc.
  • 17. Feature: Travel The World Scenario: Keep Track Of Visits Given a list like this: | Location | Times visited | | Costa Rica | 0 | | Germany | 0 | When I travel to Costa Rica Then the list should look like this: | Location | Times visited | | Costa Rica | 1 | | Germany | 0 | © 2012 AgilityFeat, Inc.
  • 18. Doc strings Scenario: Look up hostel reservation e-mail When I search for “Alexander House” Then I should see the following message: """ Welcome Mr. Haeffner. You’ll be staying in the bunk house this visit. Please refrain from stealing our towels (again). ""” © 2012 AgilityFeat, Inc.
  • 19. 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 © 2012 AgilityFeat, Inc.
  • 20. 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) © 2012 AgilityFeat, Inc.
  • 21. 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 © 2012 AgilityFeat, Inc.

Notas del editor

  1. Thanks for joining meToday we are going to step through a crash course on Cucumber &amp; GherkinWe will:Start with the benefitsProvide a brief primer on the mechanicsProvide an end-to-end exampleAnd cover the different approaches to gherkin feature writingSound good?OK – let’s get started
  2. Why do Acceptance Test Driven Development?Well, [step through pic]It also helps the team work with confidence
  3. #1 – in this case, English#2A common language between the business and the tech teamHelping you understand better what needs to be builtAnd, 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 stuffThey have the power to turn high-level acceptance criteria into specific &amp; actionable acceptance tests (either to be carried out manually, or, with automation)They also engage our brains enabling us to visualize scenarios &amp; 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
  4. So, really, it’s not just about automation, it’s about communication. To bring this point home, here’s a quote from the creator of Cucumber
  5. Okay, let’s change gears and step through the mechanics of CucumberCucumber uses Gherkin which is a universalTo be clear -- Gherkin can be used in other BDD frameworks that use other programming languagesFor our purposes, we’ll be using Cucumber &amp; RubySo, in Cucumber, there is a default folder structure – let’s step through it
  6. Capybara API: https://gist.github.com/428105
  7. Basic example (from end-to-end earlier)
  8. Extend it – there are two additional keywordsBut may be indicative of the need for another scenarioBut your mileage may varyDepends on the readability and if it works for you and the team
  9. The words don’t matter to Cucumber. They should matter to YOU
  10. This seems much more readable – don’t you think?
  11. Helper text – aka User Stories can go here
  12. Freedom to specify data in different ways – e.g. headings down the site, or just specify a listThe pipes’ spacing doesn’t matter to Cucumber