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
 

Recently uploaded (20)

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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
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
 
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...
 
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...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.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)
 
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
 
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?
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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, ...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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 New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Introduction to ATDD with Cucumber and RSpec