SlideShare a Scribd company logo
1 of 17
Download to read offline
ManiokSpecificationByExamplewith
RSpec1 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Aboutme
@21croissants
2 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Agenda
· Specification By Example
· 7 years of Cucumber: lessons learned
· Veggie alternatives
· Introducing: Maniok
· Q & A ?
3 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
SpecificationByExample/
Gherkin?
Scenario: Spec By Example workshop
Given three amigos: Developer / Product / QA
When they talk in front of a white board
And write the outcome of their discussions in "scenarios"
Then they should build the "right" thing
pic from User Story Mapping book
More at http://kickstartacademy.io/
courses/bdd-kickstart
4 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants,
2015-07-08
Cucumber?8Mdownloads
1: Write test in plain text using Gherkin DSL
# features/buy_ticket/earl_bird.feature
Scenario: Early Bird tickets have sold out
Given there are no "Early Bird" tickets le! for "Baruco 2015"
When I want to buy a ticket
Then I should see the "Early Bird" tickets as "SOLD OUT"
5 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
2. Write step definition block in ruby to match
plain text
# features/step_definitions/buy_ticket/early_bird_steps.rb
Given(/^there are no "(.*?)" tickets le! for "(.*?)"$/) do |ticket_type_name, conference_name|
ticket_type = ticket_type_name.gsub(/s/, '_').downcase.to_sym
tickets = { ticket_type => 0 }
create :conference, name: conference_name, with: tickets
end
6 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Cost
· organizing step definitions is hard
· re-use existing step defs does not scale
· Regexp in step defs false idea
· Not fun :(
7 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Slow
Given a feature with a slow background to set lots of immutable test data
When there are 15 scenarios
Then cucumber will run the background for each scenario :(
8 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Capybara"acceptance"DSL
feature "Buy Early Bird ticket" do # describe
background do # before(:each)
end
given(:other_user) { create :user } # let <- Very confusing
scenario "Early Bird tickets have sold out" do # it
visit '/'
click_on "TICKETS"
expect(page).to have_content 'SOLD OUT'
end
Syntactic sugar for devs. Not suitable for Spec By Example
9 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Veggiealternatives
10 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
turnip
# spec/acceptance/buy_ticket/earl_bird.feature
Scenario: Early Bird tickets have sold out
Given there are no "Early Bird" tickets le! for "Baruco 2015"
# spec/steps/buy_ticket/early_bird_steps.rb
module EarlyBirdSteps
step "there are no :ticket_type ticket for :conference_name" do |ticket_type, conference_name|
# same as Cucumber
end
end
By Jonas Nicklas (capybara), 264K downloads
11 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Spinach
# features/buy_ticket/earl_bird.feature
Scenario: Early Bird tickets have sold out
Given there are no "Early Bird" tickets le! for "Baruco 2015"
# features/steps/buy_ticket/early_bird_steps.rb
class Spinach::Features::TestHowSpinachWorks < Spinach::FeatureSteps
Given "there are no "ticket_type" ticket for "conference_name"" do
# Spinach assigns @ticket_type and @conference_name
# rest, same as Cucumber
end
end
By Codegram (Baruco). No I18n! 142K downloads
12 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Maniok (with a k):
RSpec.feature "Early Bird" do
before(:all) { step "Very slow data setup" { } }
scenario "Early Bird tickets have sold out" do
given 'there are no "Early Bird" tickets le! for "Baruco 2015"' do
create :conference, name: "Baruco 2015", with: { early_bird: 0 }
end
when "I want to buy a ticket" do
visit "/"; click_on "TICKETS"
end
then "I should see a big "SOLD OUT" sign and told to subscribe to the newsletter" do
expect(page).to have_content "SOLD OUT"
end
end; end
13 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
GeneratedOutputusingRSpecGherkinFormatter
# features/buy_ticket/earl_bird.feature
Feature: Early Bird
Background:
* Very slow data setup
Scenario: Early Bird tickets have sold out
Given there are no "Early Bird" tickets le! for "Baruco 2015"
When I want to buy a ticket
Then I should see a big "SOLD OUT" sign and told to subscribe to the newsletter
14 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Pros
· small footprint (cuke is 16K LOC of ruby)
· DSL: given, when, then inside scenario block
· No mapping btw plain text feature & step defs
· Declarative style. Re-use ruby test helpers not
plain text
15 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Comingsoon
· Rewrite to make it RSpec 3.0 support
· Gherkin tables & Scenario outlines support
· Tim Pope's Fivemat support w/ Profiling each
step
· HTML formatter a la cucumber
· static HTML formatter a la rdoc (searchable)
16 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
Merci!Q & A
17 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08

More Related Content

More from Jean-Michel Garnier

Tests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumberTests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumberJean-Michel Garnier
 
Fast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-gridFast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-gridJean-Michel Garnier
 
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)Jean-Michel Garnier
 
Intro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance TestingIntro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance TestingJean-Michel Garnier
 
Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Jean-Michel Garnier
 

More from Jean-Michel Garnier (9)

Cucumber Ecosystem Presentation
Cucumber Ecosystem PresentationCucumber Ecosystem Presentation
Cucumber Ecosystem Presentation
 
Tests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumberTests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumber
 
Tests Interfaces Web avec Rails
Tests Interfaces Web avec RailsTests Interfaces Web avec Rails
Tests Interfaces Web avec Rails
 
Fast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-gridFast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-grid
 
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
 
Intro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance TestingIntro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance Testing
 
Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)
 
Global Warming Lifestyle Change
Global Warming Lifestyle ChangeGlobal Warming Lifestyle Change
Global Warming Lifestyle Change
 
Testing Ruby on Rails (spanish)
Testing Ruby on Rails (spanish)Testing Ruby on Rails (spanish)
Testing Ruby on Rails (spanish)
 

Recently uploaded

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 

Recently uploaded (20)

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 

2015 07 08_genevarb_maniok_presentation

  • 1. ManiokSpecificationByExamplewith RSpec1 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 2. Aboutme @21croissants 2 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 3. Agenda · Specification By Example · 7 years of Cucumber: lessons learned · Veggie alternatives · Introducing: Maniok · Q & A ? 3 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 4. SpecificationByExample/ Gherkin? Scenario: Spec By Example workshop Given three amigos: Developer / Product / QA When they talk in front of a white board And write the outcome of their discussions in "scenarios" Then they should build the "right" thing pic from User Story Mapping book More at http://kickstartacademy.io/ courses/bdd-kickstart 4 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 5. Cucumber?8Mdownloads 1: Write test in plain text using Gherkin DSL # features/buy_ticket/earl_bird.feature Scenario: Early Bird tickets have sold out Given there are no "Early Bird" tickets le! for "Baruco 2015" When I want to buy a ticket Then I should see the "Early Bird" tickets as "SOLD OUT" 5 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 6. 2. Write step definition block in ruby to match plain text # features/step_definitions/buy_ticket/early_bird_steps.rb Given(/^there are no "(.*?)" tickets le! for "(.*?)"$/) do |ticket_type_name, conference_name| ticket_type = ticket_type_name.gsub(/s/, '_').downcase.to_sym tickets = { ticket_type => 0 } create :conference, name: conference_name, with: tickets end 6 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 7. Cost · organizing step definitions is hard · re-use existing step defs does not scale · Regexp in step defs false idea · Not fun :( 7 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 8. Slow Given a feature with a slow background to set lots of immutable test data When there are 15 scenarios Then cucumber will run the background for each scenario :( 8 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 9. Capybara"acceptance"DSL feature "Buy Early Bird ticket" do # describe background do # before(:each) end given(:other_user) { create :user } # let <- Very confusing scenario "Early Bird tickets have sold out" do # it visit '/' click_on "TICKETS" expect(page).to have_content 'SOLD OUT' end Syntactic sugar for devs. Not suitable for Spec By Example 9 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 10. Veggiealternatives 10 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 11. turnip # spec/acceptance/buy_ticket/earl_bird.feature Scenario: Early Bird tickets have sold out Given there are no "Early Bird" tickets le! for "Baruco 2015" # spec/steps/buy_ticket/early_bird_steps.rb module EarlyBirdSteps step "there are no :ticket_type ticket for :conference_name" do |ticket_type, conference_name| # same as Cucumber end end By Jonas Nicklas (capybara), 264K downloads 11 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 12. Spinach # features/buy_ticket/earl_bird.feature Scenario: Early Bird tickets have sold out Given there are no "Early Bird" tickets le! for "Baruco 2015" # features/steps/buy_ticket/early_bird_steps.rb class Spinach::Features::TestHowSpinachWorks < Spinach::FeatureSteps Given "there are no "ticket_type" ticket for "conference_name"" do # Spinach assigns @ticket_type and @conference_name # rest, same as Cucumber end end By Codegram (Baruco). No I18n! 142K downloads 12 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 13. Maniok (with a k): RSpec.feature "Early Bird" do before(:all) { step "Very slow data setup" { } } scenario "Early Bird tickets have sold out" do given 'there are no "Early Bird" tickets le! for "Baruco 2015"' do create :conference, name: "Baruco 2015", with: { early_bird: 0 } end when "I want to buy a ticket" do visit "/"; click_on "TICKETS" end then "I should see a big "SOLD OUT" sign and told to subscribe to the newsletter" do expect(page).to have_content "SOLD OUT" end end; end 13 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 14. GeneratedOutputusingRSpecGherkinFormatter # features/buy_ticket/earl_bird.feature Feature: Early Bird Background: * Very slow data setup Scenario: Early Bird tickets have sold out Given there are no "Early Bird" tickets le! for "Baruco 2015" When I want to buy a ticket Then I should see a big "SOLD OUT" sign and told to subscribe to the newsletter 14 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 15. Pros · small footprint (cuke is 16K LOC of ruby) · DSL: given, when, then inside scenario block · No mapping btw plain text feature & step defs · Declarative style. Re-use ruby test helpers not plain text 15 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 16. Comingsoon · Rewrite to make it RSpec 3.0 support · Gherkin tables & Scenario outlines support · Tim Pope's Fivemat support w/ Profiling each step · HTML formatter a la cucumber · static HTML formatter a la rdoc (searchable) 16 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08
  • 17. Merci!Q & A 17 — Maniok Lightning Talk at Geneva.rb. By Jean-Michel Garnier @21croissants, 2015-07-08