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
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
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”
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 |
....
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