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

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
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
Victor Rentea
 

Recently uploaded (20)

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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
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)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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, ...
 
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...
 

Introduction to ATDD with Cucumber and RSpec