SlideShare a Scribd company logo
1 of 48
Download to read offline
Introduction to ATDD with
         Cucumber and RSpec
         Cucumber     RSpec   ATDD
         Kenta Murata




Monday, September 26, 11             1
Kenta Murata                                            @mrkn


          CRuby committer
                bigdecimal maintainer
                OS X platform maintainer
                Interested in number system

          Ruby Sapporo



http://www.flickr.com/photos/recompile_net/5951998279/
Monday, September 26, 11                                         2
Monday, 1
2010 3 September 26, 11   3
http://rubyconf.org/schedule

Monday, September 26, 11       4
http://rubyconf.org/schedule

Monday, September 26, 11       4
Introduction to ATDD with
         Cucumber and RSpec
         Cucumber     RSpec   ATDD
         Kenta Murata




Monday, September 26, 11             5
ATDD?




Monday, September 26, 11   6
Acceptance Test
         Driven Development



Monday, September 26, 11      7
Monday, September 26, 11   8
“
         The idea of using an automated
         customer Acceptance Test was first
         proposed in April 2000 by Kent Beck.
         Instead of a stakeholder handing over
         a requirements document to the
         developers without much opportunity
         for feedback, the developer and
         stakeholder collaborate together to
         write a test that the computer can run.


Monday, September 26, 11                           9
“                      2000 4   Kent Beck




Monday, September 26, 11                        10
“                      2000 4   Kent Beck




Monday, September 26, 11                        11
“                      2000 4   Kent Beck




Monday, September 26, 11                        12
“                      2000 4   Kent Beck




Monday, September 26, 11                        13
“                      2000 4   Kent Beck




Monday, September 26, 11                        14
http://pragprog.com/book/hwcuc/the-cucumber-book
Monday, September 26, 11                           15
“    The test fails at the time of writing,
         because no code has been written yet,
         but captures what the stakeholder
         cares about and gives everyone a
         clear signal as to what it will take to be
         done.



Monday, September 26, 11                              16
“
Monday, September 26, 11   17
Unit tests v.s. Acceptance Test




Monday, September 26, 11                   18
Unit tests




Monday, September 26, 11   19
Acceptance tests




                    Feature (Usecase)
                    Scenario




Monday, September 26, 11                20
Feature




Monday, September 26, 11             21
Feature




Monday, September 26, 11   22
Monday, September 26, 11   23
http://pragprog.com/book/hwcuc/the-cucumber-book
Monday, September 26, 11                           24
Cucumber
         Feature:




               Scenario:
                    Given       “           ”
                    When    “       ”
                    Then
                    And         “       ”




Monday, September 26, 11                        25
Given /             “([^”]*)”          / do |arg|
           ...
         end

         When /            “([^”]*)”            / do |arg|
           ...
         end

         Then /                          / do
           ...
         end

         Then /             “([^”]*)”      / do |arg|
           ...
         end




Monday, September 26, 11                                     26
Cucumber


                           Feature   Scenario




Monday, September 26, 11                        27
1



                                                     red 2




                                                             3
                                                     red



                                                  RSpec
                                                                           4
                                      refactor                     green
                                              5

                           refactor                                            green 6
                                       7
                                                 Cucumber


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                 28
1



                                                     red 2




                                                             3
                                                     red



                                                  RSpec
                                                                           4
                                      refactor                     green
                                              5

                           refactor                                            green 6
                                       7
                                                 Cucumber


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                 28
1



                                                     red 2




                                                             3
                                                     red



                                                  RSpec
                                                                           4
                                      refactor                     green
                                              5

                           refactor                                            green 6
                                       7
                                                 Cucumber


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                 28
1



                                                     red 2




                           (RSpec)                           3
                                                     red



                                                  RSpec
                                                                           4
                                      refactor                     green
                                              5

                           refactor                                            green 6
                                       7
                                                 Cucumber


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                 28
1



                                                     red 2



                                                                                   view   spec

                           (RSpec)                           3
                                                     red



                                                  RSpec
                                                                           4
                                      refactor                     green
                                              5

                           refactor                                            green 6
                                       7
                                                 Cucumber


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                         28
1



                                                     red 2



                                                                                   view   spec

                           (RSpec)                           3
                                                     red
                                                                                 view

                                                  RSpec
                                                                           4
                                      refactor                     green
                                              5

                           refactor                                            green 6
                                       7
                                                 Cucumber


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                         28
1



                                                     red 2



                                                                                   view   spec

                           (RSpec)                           3
                                                     red
                                                                                 view

                                                  RSpec
                                                                           4
                                      refactor                     green
      view                                    5

                           refactor                                            green 6
                                       7
                                                 Cucumber


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                         28
1



                                                     red 2



                                                                                    view     spec

                           (RSpec)                           3
                                                     red
                                                                                 view

                                                  RSpec
                                                                           4
                                      refactor                     green
      view                                    5

                           refactor                                            green 6
                                       7
                                                 Cucumber
                                                                                (cucumber)


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                            28
1



                                                     red 2



                                                                                    view     spec

                           (RSpec)                           3
                                                     red
                                                                                 view

                                                  RSpec
                                                                           4
                                      refactor                     green
      view                                    5

                           refactor                                            green 6
                                       7
                                                 Cucumber
                                                                                (cucumber)


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                            28
1



                                                     red 2



                                                                                    view     spec

                           (RSpec)                           3
                                                     red
                                                                                 view

                                                  RSpec
                                                                           4
                                      refactor                     green
      view                                    5

                           refactor                                            green 6
                                       7
                                                 Cucumber
                                                                                (cucumber)


The RSpec Book, p.285                      (start with Cucumber)
Monday, September 26, 11                                                                            28
Demonstration




Monday, September 26, 11   29
http://tatsu-zine.com/books/cuke
Monday, September 26, 11           30
http://pragprog.com/book/achbd/the-rspec-book
Monday, September 26, 11                        31
http://pragprog.com/book/hwcuc/the-cucumber-book
Monday, September 26, 11                           32
http://pragprog.com/book/rcctr/continuous-testing
Monday, September 26, 11                            33
http://pragprog.com/book/jgade/test-driven-development-for-embedded-c
Monday, September 26, 11                                                34
http://cuke4ninja.com/
Monday, September 26, 11   35
http://ssl.ohmsha.co.jp/cgi-bin/menu.cgi?ISBN=978-4-274-06856-0
Monday, September 26, 11                                          36
http://www.informit.com/store/product.aspx?isbn=0321503627
Monday, September 26, 11                                     37
http://www.informit.com/store/product.aspx?isbn=0321601912
Monday, September 26, 11                                     38

More Related Content

Viewers also liked

Serverspec at July Tech Festa 2013
Serverspec at July Tech Festa 2013Serverspec at July Tech Festa 2013
Serverspec at July Tech Festa 2013
Gosuke Miyashita
 

Viewers also liked (20)

RSpec User Stories
RSpec User StoriesRSpec User Stories
RSpec User Stories
 
Serverspec at July Tech Festa 2013
Serverspec at July Tech Festa 2013Serverspec at July Tech Festa 2013
Serverspec at July Tech Festa 2013
 
RSpec and Rails
RSpec and RailsRSpec and Rails
RSpec and Rails
 
Rで確認しながら解く統計検定2級
Rで確認しながら解く統計検定2級Rで確認しながら解く統計検定2級
Rで確認しながら解く統計検定2級
 
RSpec: What, How and Why
RSpec: What, How and WhyRSpec: What, How and Why
RSpec: What, How and Why
 
Walter ファミリーの紹介 at Shibuya.go#1
Walter ファミリーの紹介 at Shibuya.go#1Walter ファミリーの紹介 at Shibuya.go#1
Walter ファミリーの紹介 at Shibuya.go#1
 
8つの魔法の習得 -RとRubyによるデータ解析入門より-
8つの魔法の習得 -RとRubyによるデータ解析入門より-8つの魔法の習得 -RとRubyによるデータ解析入門より-
8つの魔法の習得 -RとRubyによるデータ解析入門より-
 
gem の探し方
gem の探し方gem の探し方
gem の探し方
 
Testing Ruby with Rspec (a beginner's guide)
Testing Ruby with Rspec (a beginner's guide)Testing Ruby with Rspec (a beginner's guide)
Testing Ruby with Rspec (a beginner's guide)
 
p2pネットワーク
p2pネットワークp2pネットワーク
p2pネットワーク
 
GoでKVSを書けるのか
GoでKVSを書けるのかGoでKVSを書けるのか
GoでKVSを書けるのか
 
Why my Go program is slow?
Why my Go program is slow?Why my Go program is slow?
Why my Go program is slow?
 
Float is Legacy
Float is LegacyFloat is Legacy
Float is Legacy
 
すごいタスク管理(仮)
すごいタスク管理(仮)すごいタスク管理(仮)
すごいタスク管理(仮)
 
RSpec on Rails Tutorial
RSpec on Rails TutorialRSpec on Rails Tutorial
RSpec on Rails Tutorial
 
Serverspec at Testing Framework Meeting
Serverspec at Testing Framework MeetingServerspec at Testing Framework Meeting
Serverspec at Testing Framework Meeting
 
Presto changes
Presto changesPresto changes
Presto changes
 
DevDay 2016: Dave Farley - Acceptance testing for continuous delivery
DevDay 2016: Dave Farley - Acceptance testing for continuous deliveryDevDay 2016: Dave Farley - Acceptance testing for continuous delivery
DevDay 2016: Dave Farley - Acceptance testing for continuous delivery
 
Rubyによるデータ解析
Rubyによるデータ解析Rubyによるデータ解析
Rubyによるデータ解析
 
Fluentd at Bay Area Kubernetes Meetup
Fluentd at Bay Area Kubernetes MeetupFluentd at Bay Area Kubernetes Meetup
Fluentd at Bay Area Kubernetes Meetup
 

More from Kenta Murata

The world without float literal
The world without float literalThe world without float literal
The world without float literal
Kenta Murata
 
Rubykaigi2010mrkn bigdecimal
Rubykaigi2010mrkn bigdecimalRubykaigi2010mrkn bigdecimal
Rubykaigi2010mrkn bigdecimal
Kenta Murata
 
情報学特論#02
情報学特論#02情報学特論#02
情報学特論#02
Kenta Murata
 
情報学特論#01
情報学特論#01情報学特論#01
情報学特論#01
Kenta Murata
 
北海道関数型言語勉強会@札幌#2のお知らせ
北海道関数型言語勉強会@札幌#2のお知らせ北海道関数型言語勉強会@札幌#2のお知らせ
北海道関数型言語勉強会@札幌#2のお知らせ
Kenta Murata
 

More from Kenta Murata (17)

The world without the literal notation for floating-point numbers
The world without the literal notation for floating-point numbersThe world without the literal notation for floating-point numbers
The world without the literal notation for floating-point numbers
 
The world without float literal
The world without float literalThe world without float literal
The world without float literal
 
Ruby 1.9.3 の新機能と変更点
Ruby 1.9.3 の新機能と変更点Ruby 1.9.3 の新機能と変更点
Ruby 1.9.3 の新機能と変更点
 
関数型プログラミングの世界
関数型プログラミングの世界関数型プログラミングの世界
関数型プログラミングの世界
 
Let's begin Behavior Driven Development using RSpec
Let's begin Behavior Driven Development using RSpecLet's begin Behavior Driven Development using RSpec
Let's begin Behavior Driven Development using RSpec
 
Rubyをたのしくするために私が考えていること
Rubyをたのしくするために私が考えていることRubyをたのしくするために私が考えていること
Rubyをたのしくするために私が考えていること
 
5分弱で分かる量子ビット
5分弱で分かる量子ビット5分弱で分かる量子ビット
5分弱で分かる量子ビット
 
Rubykaigi2010mrkn bigdecimal
Rubykaigi2010mrkn bigdecimalRubykaigi2010mrkn bigdecimal
Rubykaigi2010mrkn bigdecimal
 
Ruby における絵文字エンコーディング間の相互変換ダイアグラム (案)
Ruby における絵文字エンコーディング間の相互変換ダイアグラム (案)Ruby における絵文字エンコーディング間の相互変換ダイアグラム (案)
Ruby における絵文字エンコーディング間の相互変換ダイアグラム (案)
 
校内勉強会のススメ An encouragement to hold workshops In your school
校内勉強会のススメ An encouragement to hold workshops In your school校内勉強会のススメ An encouragement to hold workshops In your school
校内勉強会のススメ An encouragement to hold workshops In your school
 
Ruby の標準乱数生成器とその改善案
Ruby の標準乱数生成器とその改善案Ruby の標準乱数生成器とその改善案
Ruby の標準乱数生成器とその改善案
 
5分で分かる Measure
5分で分かる Measure5分で分かる Measure
5分で分かる Measure
 
Measure 単位付き数値ライブラリ
Measure 単位付き数値ライブラリMeasure 単位付き数値ライブラリ
Measure 単位付き数値ライブラリ
 
情報学特論#02
情報学特論#02情報学特論#02
情報学特論#02
 
情報学特論#01
情報学特論#01情報学特論#01
情報学特論#01
 
北海道関数型言語勉強会@札幌#2のお知らせ
北海道関数型言語勉強会@札幌#2のお知らせ北海道関数型言語勉強会@札幌#2のお知らせ
北海道関数型言語勉強会@札幌#2のお知らせ
 
Ruby 拡張モジュール入門
Ruby 拡張モジュール入門Ruby 拡張モジュール入門
Ruby 拡張モジュール入門
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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...
 
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
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Introduction to ATDD with Cucumber and RSpec