Behavior Driven Development with Cucumber
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Behavior Driven Development with Cucumber

on

  • 43,765 views

 

Statistics

Views

Total Views
43,765
Views on SlideShare
38,928
Embed Views
4,837

Actions

Likes
57
Downloads
1,046
Comments
4

23 Embeds 4,837

http://blog.webintellix.com 4611
http://www.slideshare.net 160
http://l.lj-toys.com 15
http://tomnemeth.blogspot.cz 8
http://tomnemeth.blogspot.co.uk 6
http://tomnemeth.blogspot.de 6
http://lj-toys.com 5
http://www.e-presentations.us 3
http://us-w1.rockmelt.com 3
http://translate.googleusercontent.com 3
https://7714174_ff2de80110af3315d394e715b1ac8b99b22e5af5.blogspot.com 2
http://tomnemeth.blogspot.com 2
http://feeds.webintellix.com 2
http://127.0.0.1:9999 2
http://feeds.feedburner.com 1
http://webcache.googleusercontent.com 1
http://tomnemeth.blogspot.pt 1
http://paper.li 1
http://a0.twimg.com 1
http://cc.bingj.com 1
http://7714174_ff2de80110af3315d394e715b1ac8b99b22e5af5.blogspot.com 1
http://seekr-artemis.heroku.com 1
https://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Behavior Driven Development with Cucumber Presentation Transcript

  • 1. Behavior Driven Development Cucumber with Brandon Keepers ● Collective idea ● http://opensoul.org http://flickr.com/photos/nickatkins/527421404/
  • 2. Feature: Cucumber In order to share the love As a presenter I will demonstrate behavior driven development with Cucumber Scenario: Behavior Driven Development with Cucumber Given a desire for higher quality software And a tool that executes feature documentation written in plain text When you watch this presentation Then you will gain an understanding of behavior driven development And see examples of behavior driven development with cucumber And be equipped to integrate Cucumber into your development process
  • 3. Quality
  • 4. 1 Quality meets requirements
  • 5. Developer Language Client
  • 6. Developer Stories Client
  • 7. In order to keep of track movies that I want to see As a NetFlix customer I can add movies to a queue http://dannorth.net/whats-in-a-story
  • 8. va l ue p ro p o s i t i o n In order to keep of track movies that I want to see As a NetFlix customer I can add movies to a queue http://dannorth.net/whats-in-a-story
  • 9. In order to keep of track movies that I want to see As a NetFlix customer role I can add movies to a queue http://dannorth.net/whats-in-a-story
  • 10. In order to keep of track movies that I want to see As a NetFlix customer I can add movies to a queue e at u re f http://dannorth.net/whats-in-a-story
  • 11. 2 Quality works as expected
  • 12. Test Driven
  • 13. Behavior Driven
  • 14. Verify
  • 15. Confidence
  • 16. Design
  • 17. Behavior
  • 18. Testing Specifying
  • 19. Cucumber http://flickr.com/photos/nickatkins/527421404/
  • 20. rbehave rSpec Story Runner Cucumber
  • 21. http://github.com/aslakhellesoy/cucumber
  • 22. $ gem install cucumber
  • 23. Rakefile require 'rubygems' require 'cucumber/rake/task' Cucumber::Rake::Task.new
  • 24. $ rake features
  • 25. Rails $ ruby script/plugin install git://github.com/aslakhellesoy/cucumber.git git://github.com/brynary/webrat.git git://github.com/dchelimsky/rspec.git git://github.com/dchelimsky/rspec-rails.git $ ruby script/plugin install git://brandon.local/cucumber git://brandon.local/webrat git://brandon.local/rspec git://brandon.local/rspec-rails
  • 26. Dependencies $ gem install term-ansicolor treetop diff-lcs hpricot
  • 27. $ ruby script/generate cucumber
  • 28. Feature: Manage companies In order to keep track of companies A user Should be able to manage companies Scenario: Create a new company Given I am logged in When I create a new company named Acme Then I should see that a company named Acme exists
  • 29. features/ companies.feature steps/ company_steps.rb
  • 30. Given == Setup Given quot;I am logged inquot; do user = Factory(:user) visits new_session_path fills_in ‘Login’, :with => user.login fills_in ‘Password’, :with => user.password clicks_button ‘Login’ end
  • 31. Given quot;I am logged inquot; do user = Factory(:user) f ac t o r y_g i r l visits new_session_path fills_in ‘Login’, :with => user.login fills_in ‘Password’, :with => user.password clicks_button ‘Login’ end Factory.sequence(:email) {|n| quot;user#{n}@example.comquot; } Factory.define :user do |user| user.name 'User' user.email { Factory.next(:email) } user.login {|u| u.email } user.password 'password' user.password_confirmation 'password' end
  • 32. Given quot;I am logged inquot; do user = Factory(:user) visits new_session_path fills_in 'Login', :with => user.login fills_in 'Password', :with => user.password clicks_button 'Login' end we b rat
  • 33. When == Change When quot;I create a new company named $namequot; do |name| visits new_company_path fills_in 'Name', :with => name clicks_button 'Create' end
  • 34. When == Change v a r i a ble When quot;I create a new company named $namequot; do |name| visits new_company_path fills_in 'Name', :with => name clicks_button 'Create' end When I create a new company named Acme
  • 35. Then == Outcome Then quot;I should see that a company named $name existsquot; do |name| response.body.should =~ Regexp.new(name) end
  • 36. Feature: Manage companies In order to keep track of companies A user Should be able to manage companies Scenario: Create a new company Given I am logged in When I create a new company named Acme Then I should see that a company named Acme exists 3 steps passsed
  • 37. Scenario: Paging through leads and rejecting Given a company called Apple Corp. And a company called Pear Inc. And a list for Client A And Apple Corp. is a new lead in a list for Client A And Pear Inc. is a new lead in a list for Client A And I am logged in as a staff member When I view the company overview for Apple Corp. And I reject Apple Corp. And I go to the next lead Then I see the company overview for Pear Inc.
  • 38. Cucumber or RSpec?
  • 39. Cucumber or RSpec? BOTH
  • 40. http://github.com/bmabey/cucumber-tmbundle/
  • 41. Feature: Cucumber In order to share the love As a presenter I will demonstrate behavior driven development with Cucumber Scenario: Behavior Driven Development with Cucumber Given a desire for higher quality software And a tool that executes feature documentation written in plain text When you watch this presentation Then you will gain an understanding of behavior driven development And see examples of behavior driven development with cucumber And be equipped to integrate Cucumber into your development process 6 steps passed
  • 42. @bkeepers github.com/ brandon collectiveidea opensoul.org sessions.collectiveidea.com