SlideShare ist ein Scribd-Unternehmen logo
1 von 68
Downloaden Sie, um offline zu lesen
Acceptance Testing

In the land of the startup



                         Joseph Wilk
What kind of land is this?
What kind of land is this?
Do startups need
acceptance tests?

    Build           Measure



            Learn
Context
      is king
Toolset




Rails, MongoDB, Mysql,       Cucumber, Rspec
RabbitMQ, Memcache
Cucumber
•   Behaviour Driven    Feature: Filling Cucumbers with
    Development         rocket fuel
    framework
                        Scenario: Rocket fuel
•   Plaintext             Given I have trained monkeys
                          When I click the launch button
•   Promotes              Then the monkeys should not die
    communication

                       Given /^I have trained monkeys$/ do
                         @test_pilots << Monkeys.new
                       end
Why Acceptance?

• Developer centric tool
• Behaviour Driven
  Development

• Conversations
Where acceptance
               tests are born


      Product                Developer
      Owner




   User
interaction                       QA
Where acceptance
               tests are born

                   Just In Time
      Product
                      Talking     Developer
      Owner




   User
interaction                            QA
Non-technical
people writing
  Gherkin?
Feature: Ajax pagination for upcoming events
  In order to reduce friction finding concerts I want to go to
  As a logged in user
  I want an Ajax button which loads more concerts

 Scenario: Events 60 days in the futures
   Given ...
   When ...
   Then ...

 Scenario: No events outside of the next 60 days
   Given ...
   When ...
   Then ...

 Scenario: No events
   Given ...
   When ...
   Then ...
Are we done yet?

“A story isn't done until it is being
used by real users
in production and has been validated to be a
useful part of a product.”
                                Joshua Kerievsky
Learnings
      Good and bad
Asynchronous Testing is
        messy
Scenario: Upload image
  ...
  Given all the messages have been processed
  ...
Feature Overload

254    Feature files
1257   Scenarios/Examples
10807 Steps
Slicing Features
@media, @public
Feature: Visitor views artist’s media

@feed, @admin
Feature: Logged in user views views their activity feed


 Tagging                    $ cucumber --tags @media

 Filenames                  $ cucumber visitor_*

 Subsystems                 $ cucumber features/admin/*

 Profiles                    $ cucumber --profile admin
Acceptance tests
          vs
      Unit tests
The Test Build

254 Features, 1257 scenarios, 10807 steps
The Test Build

254 Features, 1257 scenarios, 10807 steps

   1 build server ~ 4 hours
The Test Build

  254 Features, 1257 scenarios, 10807 steps

      1 build server ~ 4 hours
19 EC2 build servers ~ 13:40 minutes
The Test Build

  254 Features, 1257 scenarios, 10807 steps

      1 build server ~ 4 hours
19 EC2 build servers ~ 13:40 minutes

            $2068.99/$3000
Divide and Concuquer
Divide and Concuquer
Divide and Concuquer
Divide and Concuquer
Divide and Concuquer
Divide and Concuquer

Scenario: Related artists
 Given an artist “SYGC”
 And “M.Bison” is related to “SYGC”
 When I visit the artist
 Then I should see within Similar
      Artists a link to “M.Bison”
Divide and conquer


   Rails


Scenario: Related artists
 Given an artist “SYGC”
 And “M.Bison” is related to “SYGC”
 When I visit the artist
 Then I should see within Similar
      Artists a link to “M.Bison”
Divide and conquer

                                      Related
   Rails                              Artists
                                      Service

Scenario: Related artists
 Given an artist “SYGC”
 And “M.Bison” is related to “SYGC”
 When I visit the artist
 Then I should see within Similar
      Artists a link to “M.Bison”
Divide and conquer

                 related(artist)
                                      Related
   Rails                              Artists
                                      Service

Scenario: Related artists
 Given an artist “SYGC”
 And “M.Bison” is related to “SYGC”
 When I visit the artist
 Then I should see within Similar
      Artists a link to “M.Bison”
Divide and conquer

                 related(artist)
                                      Related
   Rails             HTML             Artists
                                      Service

Scenario: Related artists
 Given an artist “SYGC”
 And “M.Bison” is related to “SYGC”
 When I visit the artist
 Then I should see within Similar
      Artists a link to “M.Bison”
Divide and conquer

          related(artist)
                                        Related
Rails         HTML                      Artists
                                        Service

                            Scenario: Related artists
                             Given an artist “SYGC”
                             And “M.Bison” is related to “SYGC”
                             When I visit the artist
                             Then I should see within Similar
                                  Artists a link to “M.Bison”
Divide and conquer

            related(artist)
                                                   Related
Rails               HTML                           Artists
                                                   Service
        unit test          unit test
                                       Scenario: Related artists
                                        Given an artist “SYGC”
                                        And “M.Bison” is related to “SYGC”
                                        When I visit the artist
                                        Then I should see within Similar
                                             Artists a link to “M.Bison”
Tests that
never fail
Tests that
never fail
Tests which      Tests that
regularly fail   never fail
Tests which      Tests that
regularly fail   never fail




Daily Build
Tests which       Tests that
regularly fail    never fail




Daily Build      Nightly Build
Tests which                   Tests that
      regularly fail                never fail




       Daily Build                Nightly Build

$cucumber --tags ~@nightly   $cucumber --tags @nightly
Flickering Confidence
Flickering Confidence
               FAIL
Flickering Confidence
               FAIL

               FAIL
Flickering Confidence
               FAIL

               FAIL

               PASS
Flickering Confidence
                     FAIL

                     FAIL

                     PASS




  Main   @flicker   Flicker
Pairwise
Scenario: Testing Cucumber against different environments
  Given I have a rails app <Rails version>
  And I’m using Ruby <Ruby version>
  And I am using the <Test Framework>
  And I am using the driver <Driver>
  Then Cucumber should install and play nicely
  Examples:
  | Rails version | Ruby version | test framework | Driver     |
  |           3.0 |        1.8.7 | Rspec          | Webrat     |
  |           3.0 |        1.8.7 | Testunit       | Capybara   |
  |           3.0 |        1.8.7 | Rspec          | Capybara   |
  |           3.0 |        1.8.7 | Testunit       | Webrat     |
  |           3.0 |          1.9 | Rspec          | Webrat     |
  |           3.0 |          1.9 | Testunit       | Webrat     |
  |         2.3.1 |          1.9 | Rspec          | Webrat     |
                             ....
| Rails version | Ruby version | test framework   |   Driver     |
|         2.3.1 |        1.8.7 | Rspec            |   Webrat     |
|         2.3.1 |        1.8.7 | Rspec            |   Capybara   |
|         2.3.1 |        1.8.7 | Testunit         |   Webrat     |
|         2.3.1 |        1.8.7 | Testunit         |   Capybara   |
|         2.3.1 |        1.9   | Rspec            |   Capybara   |
|         2.3.1 |        1.9   | Rspec            |   Webrat     |
|         2.3.1 |        1.9   | Testunit         |   Capybara   |
|         2.3.1 |        1.9   | Testunit         |   Webrat |

                           ....




“most faults are caused by interactions of at most two
factors”
Run Just Enough Tests
                       Autotest
 #   *   Test files must be stored in test/
 #   *   Test files names must start with test_
 #   *   Test class names must start with Test
 #   *   Implementation files must be stored in lib/
 #   *   Implementation files must match up with a
 #        test file named
 #        test_.*implementation.rb


                       Cucover

 @analyzer = Rcov::CodeCoverageAnalyzer.new
The Art of

         War Plaintext
                   ,                                               ,
                  @"===,                                  ,_____cctI
                  "?AAAAAAAAAAAAAAAA,,,,,,,,,,,,,,,,,,,,,;LLLLLLLLLL
       ~",,,       1""""""""""""###OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
        '"EEEEE, !'"***"~~~~~~"OOOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
           ,EEEEE)>"'''???????"WWW!MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
             "E.,)+="WWW~~~~~~#"OOO1OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
         ,~:#")LLL!"+++???????"$$$1==========##/
          &LLLLLLLLL;;;;;;;;;;;;,,,/
          1#LLLLLLLLLLLLLLLLLLLLLL!
        ,!###LLLLLL"'EEEE,'"LLLLL!
        !######LLL" "EEE" "LLLL"
       !#########L!    "EEJ. "LL!
      !##########1       "JJ*,l"
    !############"!         ,l"
    1##########" 1"~~,~~"
   !##########"
  !###########!
  !###########1
 !############!
 1#############
!"#############"
!##############!
1##########"'                               A magnum, By calendron
1#####"'
"""""
Don’t force
              Feature: Title
                In order to <value>
                As a <role>

 structure      I want <feature>
Avoid Noise!
               Given I am able to login
               Given I am able to login
Avoid       Given I login
                Given I authenticate

Inconsistency   Given I gain access
Given   I go to the login page


 Balance
              And I   fill in "username" with "cuke"
              And I   fill in "password" with "cuker"
              And I   click "login"

Abstraction   Given I'm logged in
Use Language
               Building blocks
Given /I’m logged in/ do
  User.create!(:user => 'josephwilk', :password => "pass")
  Given 'I fill in "password" with "josephwilk"'
  Given 'I fill in "password" with "pass"'
  Given 'I click "login"'
end
Continuous Integration(WIP)
    Fail
  Work in    Pass
             Done
  Pending
  progress

    add       list    $ cucumber --wip
   movies    movies
                                 --tags @WIP
                                 features/
    edit
   movies


   delete
   movies
Limiting Tags in Flow
   Work in
                    Done
   progress

 add add add add
movies movies
   movies movies           $ cucumber --tags @WIP:3
                                      features/
 add add add edit
movies movies
   movies movies


 add add add
           delete
movies movies
   movies movies
Further reading

•   http://cukes.info

•   http://wiki.github.com/
    aslakhellesoy/cucumber

•   http://www.cuke4ninja.com/

•   http://blog.josephwilk.net
Thanks!


               Joseph Wilk
              @josephwilk
http://blog.josephwilk.net

Weitere ähnliche Inhalte

Ähnlich wie Acceptance testing in the land of the startup

Rapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoopRapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoopRaymond Camden
 
Acceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvmAcceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvmChristopher Bartling
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on RailsAvi Kedar
 
Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014ryanstout
 
PTW Rails Bootcamp
PTW Rails BootcampPTW Rails Bootcamp
PTW Rails BootcampMat Schaffer
 
David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?mdevtalk
 
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the serverArquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the serverLukáš Fryč
 
Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015
Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015
Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015Leonardo Borges
 
Cross-browser testing in the real world
Cross-browser testing in the real worldCross-browser testing in the real world
Cross-browser testing in the real worldMartin Kleppmann
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launchedMat Schaffer
 
End-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystemEnd-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystemAlex Mikitenko
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryAmazon Web Services
 
Building RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeBuilding RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeDaniel Doubrovkine
 
The Ruby Racer: under the hood
The Ruby Racer: under the hoodThe Ruby Racer: under the hood
The Ruby Racer: under the hoodcowboyd
 
Clearly, I Have Made Some Bad Decisions
Clearly, I Have Made Some Bad DecisionsClearly, I Have Made Some Bad Decisions
Clearly, I Have Made Some Bad DecisionsJonathan Hitchcock
 

Ähnlich wie Acceptance testing in the land of the startup (20)

Rapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoopRapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoop
 
Acceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvmAcceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvm
 
TorqueBox
TorqueBoxTorqueBox
TorqueBox
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 
Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014
 
Cucumber
CucumberCucumber
Cucumber
 
PTW Rails Bootcamp
PTW Rails BootcampPTW Rails Bootcamp
PTW Rails Bootcamp
 
Wwcode2
Wwcode2Wwcode2
Wwcode2
 
David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?David Bilík: Anko – modern way to build your layouts?
David Bilík: Anko – modern way to build your layouts?
 
RxSwift to Combine
RxSwift to CombineRxSwift to Combine
RxSwift to Combine
 
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the serverArquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the server
 
Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015
Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015
Realtime collaboration with Clojure - EuroClojure - Barcelona, 2015
 
Cucumber
CucumberCucumber
Cucumber
 
Cross-browser testing in the real world
Cross-browser testing in the real worldCross-browser testing in the real world
Cross-browser testing in the real world
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launched
 
End-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystemEnd-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystem
 
GPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s StoryGPSTEC304_Shipping With PorpoiseA K8s Story
GPSTEC304_Shipping With PorpoiseA K8s Story
 
Building RESTful APIs w/ Grape
Building RESTful APIs w/ GrapeBuilding RESTful APIs w/ Grape
Building RESTful APIs w/ Grape
 
The Ruby Racer: under the hood
The Ruby Racer: under the hoodThe Ruby Racer: under the hood
The Ruby Racer: under the hood
 
Clearly, I Have Made Some Bad Decisions
Clearly, I Have Made Some Bad DecisionsClearly, I Have Made Some Bad Decisions
Clearly, I Have Made Some Bad Decisions
 

Mehr von Joseph Wilk

Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Joseph Wilk
 
Rubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkRubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkJoseph Wilk
 
The Limited Red Society
The Limited Red SocietyThe Limited Red Society
The Limited Red SocietyJoseph Wilk
 
The Limited Red Society
The Limited Red Society The Limited Red Society
The Limited Red Society Joseph Wilk
 
Testing outside of the Ruby World
Testing outside of the Ruby WorldTesting outside of the Ruby World
Testing outside of the Ruby WorldJoseph Wilk
 
Rubyconf lightning talk
Rubyconf lightning talkRubyconf lightning talk
Rubyconf lightning talkJoseph Wilk
 
Cucumber Patterns Workshop
Cucumber Patterns WorkshopCucumber Patterns Workshop
Cucumber Patterns WorkshopJoseph Wilk
 
Cucumber Ru09 Web
Cucumber Ru09 WebCucumber Ru09 Web
Cucumber Ru09 WebJoseph Wilk
 
Dynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsDynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsJoseph Wilk
 
Outside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecOutside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecJoseph Wilk
 
Testing with Ruby
Testing with RubyTesting with Ruby
Testing with RubyJoseph Wilk
 

Mehr von Joseph Wilk (15)

Frozenrails2011
Frozenrails2011Frozenrails2011
Frozenrails2011
 
Acceptance testing in the land of the startup
Acceptance testing in the land of the startup Acceptance testing in the land of the startup
Acceptance testing in the land of the startup
 
Rubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talkRubykaigi 2011 Limited Red talk
Rubykaigi 2011 Limited Red talk
 
The Limited Red Society
The Limited Red SocietyThe Limited Red Society
The Limited Red Society
 
The Limited Red Society
The Limited Red Society The Limited Red Society
The Limited Red Society
 
Spa2011
Spa2011Spa2011
Spa2011
 
Testing outside of the Ruby World
Testing outside of the Ruby WorldTesting outside of the Ruby World
Testing outside of the Ruby World
 
Rubyconf lightning talk
Rubyconf lightning talkRubyconf lightning talk
Rubyconf lightning talk
 
Cucumber Patterns Workshop
Cucumber Patterns WorkshopCucumber Patterns Workshop
Cucumber Patterns Workshop
 
Musichackday
MusichackdayMusichackday
Musichackday
 
Cucumber Ru09 Web
Cucumber Ru09 WebCucumber Ru09 Web
Cucumber Ru09 Web
 
Cucumbered
CucumberedCucumbered
Cucumbered
 
Dynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the StringsDynamic Workflow Pulling the Strings
Dynamic Workflow Pulling the Strings
 
Outside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecOutside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and Rspec
 
Testing with Ruby
Testing with RubyTesting with Ruby
Testing with Ruby
 

Acceptance testing in the land of the startup

  • 1. Acceptance Testing In the land of the startup Joseph Wilk
  • 2. What kind of land is this?
  • 3. What kind of land is this?
  • 4. Do startups need acceptance tests? Build Measure Learn
  • 5. Context is king
  • 6.
  • 7.
  • 8. Toolset Rails, MongoDB, Mysql, Cucumber, Rspec RabbitMQ, Memcache
  • 9. Cucumber • Behaviour Driven Feature: Filling Cucumbers with Development rocket fuel framework Scenario: Rocket fuel • Plaintext Given I have trained monkeys When I click the launch button • Promotes Then the monkeys should not die communication Given /^I have trained monkeys$/ do @test_pilots << Monkeys.new end
  • 10. Why Acceptance? • Developer centric tool • Behaviour Driven Development • Conversations
  • 11. Where acceptance tests are born Product Developer Owner User interaction QA
  • 12. Where acceptance tests are born Just In Time Product Talking Developer Owner User interaction QA
  • 13.
  • 14.
  • 16.
  • 17. Feature: Ajax pagination for upcoming events In order to reduce friction finding concerts I want to go to As a logged in user I want an Ajax button which loads more concerts Scenario: Events 60 days in the futures Given ... When ... Then ... Scenario: No events outside of the next 60 days Given ... When ... Then ... Scenario: No events Given ... When ... Then ...
  • 18. Are we done yet? “A story isn't done until it is being used by real users in production and has been validated to be a useful part of a product.” Joshua Kerievsky
  • 19. Learnings Good and bad
  • 20. Asynchronous Testing is messy Scenario: Upload image ... Given all the messages have been processed ...
  • 21. Feature Overload 254 Feature files 1257 Scenarios/Examples 10807 Steps
  • 22. Slicing Features @media, @public Feature: Visitor views artist’s media @feed, @admin Feature: Logged in user views views their activity feed Tagging $ cucumber --tags @media Filenames $ cucumber visitor_* Subsystems $ cucumber features/admin/* Profiles $ cucumber --profile admin
  • 23. Acceptance tests vs Unit tests
  • 24. The Test Build 254 Features, 1257 scenarios, 10807 steps
  • 25. The Test Build 254 Features, 1257 scenarios, 10807 steps 1 build server ~ 4 hours
  • 26. The Test Build 254 Features, 1257 scenarios, 10807 steps 1 build server ~ 4 hours 19 EC2 build servers ~ 13:40 minutes
  • 27. The Test Build 254 Features, 1257 scenarios, 10807 steps 1 build server ~ 4 hours 19 EC2 build servers ~ 13:40 minutes $2068.99/$3000
  • 33. Divide and Concuquer Scenario: Related artists Given an artist “SYGC” And “M.Bison” is related to “SYGC” When I visit the artist Then I should see within Similar Artists a link to “M.Bison”
  • 34. Divide and conquer Rails Scenario: Related artists Given an artist “SYGC” And “M.Bison” is related to “SYGC” When I visit the artist Then I should see within Similar Artists a link to “M.Bison”
  • 35. Divide and conquer Related Rails Artists Service Scenario: Related artists Given an artist “SYGC” And “M.Bison” is related to “SYGC” When I visit the artist Then I should see within Similar Artists a link to “M.Bison”
  • 36. Divide and conquer related(artist) Related Rails Artists Service Scenario: Related artists Given an artist “SYGC” And “M.Bison” is related to “SYGC” When I visit the artist Then I should see within Similar Artists a link to “M.Bison”
  • 37. Divide and conquer related(artist) Related Rails HTML Artists Service Scenario: Related artists Given an artist “SYGC” And “M.Bison” is related to “SYGC” When I visit the artist Then I should see within Similar Artists a link to “M.Bison”
  • 38. Divide and conquer related(artist) Related Rails HTML Artists Service Scenario: Related artists Given an artist “SYGC” And “M.Bison” is related to “SYGC” When I visit the artist Then I should see within Similar Artists a link to “M.Bison”
  • 39. Divide and conquer related(artist) Related Rails HTML Artists Service unit test unit test Scenario: Related artists Given an artist “SYGC” And “M.Bison” is related to “SYGC” When I visit the artist Then I should see within Similar Artists a link to “M.Bison”
  • 40.
  • 41.
  • 42.
  • 43.
  • 46. Tests which Tests that regularly fail never fail
  • 47. Tests which Tests that regularly fail never fail Daily Build
  • 48. Tests which Tests that regularly fail never fail Daily Build Nightly Build
  • 49. Tests which Tests that regularly fail never fail Daily Build Nightly Build $cucumber --tags ~@nightly $cucumber --tags @nightly
  • 53. Flickering Confidence FAIL FAIL PASS
  • 54. Flickering Confidence FAIL FAIL PASS Main @flicker Flicker
  • 55. Pairwise Scenario: Testing Cucumber against different environments Given I have a rails app <Rails version> And I’m using Ruby <Ruby version> And I am using the <Test Framework> And I am using the driver <Driver> Then Cucumber should install and play nicely Examples: | Rails version | Ruby version | test framework | Driver | | 3.0 | 1.8.7 | Rspec | Webrat | | 3.0 | 1.8.7 | Testunit | Capybara | | 3.0 | 1.8.7 | Rspec | Capybara | | 3.0 | 1.8.7 | Testunit | Webrat | | 3.0 | 1.9 | Rspec | Webrat | | 3.0 | 1.9 | Testunit | Webrat | | 2.3.1 | 1.9 | Rspec | Webrat | ....
  • 56. | Rails version | Ruby version | test framework | Driver | | 2.3.1 | 1.8.7 | Rspec | Webrat | | 2.3.1 | 1.8.7 | Rspec | Capybara | | 2.3.1 | 1.8.7 | Testunit | Webrat | | 2.3.1 | 1.8.7 | Testunit | Capybara | | 2.3.1 | 1.9 | Rspec | Capybara | | 2.3.1 | 1.9 | Rspec | Webrat | | 2.3.1 | 1.9 | Testunit | Capybara | | 2.3.1 | 1.9 | Testunit | Webrat | .... “most faults are caused by interactions of at most two factors”
  • 57. Run Just Enough Tests Autotest # * Test files must be stored in test/ # * Test files names must start with test_ # * Test class names must start with Test # * Implementation files must be stored in lib/ # * Implementation files must match up with a # test file named # test_.*implementation.rb Cucover @analyzer = Rcov::CodeCoverageAnalyzer.new
  • 58.
  • 59. The Art of War Plaintext , , @"===, ,_____cctI "?AAAAAAAAAAAAAAAA,,,,,,,,,,,,,,,,,,,,,;LLLLLLLLLL ~",,, 1""""""""""""###OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO '"EEEEE, !'"***"~~~~~~"OOOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ,EEEEE)>"'''???????"WWW!MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM "E.,)+="WWW~~~~~~#"OOO1OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ,~:#")LLL!"+++???????"$$$1==========##/ &LLLLLLLLL;;;;;;;;;;;;,,,/ 1#LLLLLLLLLLLLLLLLLLLLLL! ,!###LLLLLL"'EEEE,'"LLLLL! !######LLL" "EEE" "LLLL" !#########L! "EEJ. "LL! !##########1 "JJ*,l" !############"! ,l" 1##########" 1"~~,~~" !##########" !###########! !###########1 !############! 1############# !"#############" !##############! 1##########"' A magnum, By calendron 1#####"' """""
  • 60. Don’t force Feature: Title In order to <value> As a <role> structure I want <feature>
  • 61. Avoid Noise! Given I am able to login Given I am able to login
  • 62. Avoid Given I login Given I authenticate Inconsistency Given I gain access
  • 63. Given I go to the login page Balance And I fill in "username" with "cuke" And I fill in "password" with "cuker" And I click "login" Abstraction Given I'm logged in
  • 64. Use Language Building blocks Given /I’m logged in/ do User.create!(:user => 'josephwilk', :password => "pass") Given 'I fill in "password" with "josephwilk"' Given 'I fill in "password" with "pass"' Given 'I click "login"' end
  • 65. Continuous Integration(WIP) Fail Work in Pass Done Pending progress add list $ cucumber --wip movies movies --tags @WIP features/ edit movies delete movies
  • 66. Limiting Tags in Flow Work in Done progress add add add add movies movies movies movies $ cucumber --tags @WIP:3 features/ add add add edit movies movies movies movies add add add delete movies movies movies movies
  • 67. Further reading • http://cukes.info • http://wiki.github.com/ aslakhellesoy/cucumber • http://www.cuke4ninja.com/ • http://blog.josephwilk.net
  • 68. Thanks! Joseph Wilk @josephwilk http://blog.josephwilk.net