Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cuke2Beer

1,913 views

Published on

5 minute presentation on cucumber presented at DemoCampGuelph11

  • Be the first to comment

Cuke2Beer

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7. How do we know we are done?<br />Build<br />Specification<br />Tests Cases<br />Test<br />Deploy<br /><ul><li>Long feedback loops
  8. 8. Keeping specs, system and test cases in sync
  9. 9. Silos of specification, build, test</li></li></ul><li><ul><li>Reduces feedback loops
  10. 10. Combines specifications, test cases &code
  11. 11. Promotes collaboration</li></li></ul><li>Specification<br />Executable!<br />
  12. 12. Executable Specification<br />
  13. 13. Cucumber Organization<br />Load<br />Match<br />Features<br />Step Definitions<br />Call<br />System Under Test<br />
  14. 14. Feature File<br />Feature: Turn cucumber into beer<br /> As a cucumber presenter<br /> I want beer after my presentation<br /> So I can enjoy the rest of DemoCampGuelph<br /> Scenario: Brydon buys Declan beer<br />Given Brydon hosts DemoCampGuelph<br />When Declan demos Cucumber<br />Then Brydon should buy Declan 1 beer<br />Scenario: Ali buys Declan beer<br />Given Ali hosts DemoCampGuelph<br />When Declan demos Cucumber<br />Then Ali should buy Declan 1 beer<br />
  15. 15. Step Definitions<br />Given /^(.+) hosts/ do |host|<br /> @event = Event.new(host)<br />end<br />When/^(.+) demos/ do |presenter|<br /> @event.add(presenter)<br />end<br />Then/^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item|<br /> perk = @event.perks[0]; <br />perk.buyer.should == buyer; perk.receiver.should == drinker<br />perk.quantity.should == quantity.to_i; perk.item.should == item <br />end<br />
  16. 16. System Under Test<br />class Event<br />attr_reader :perks<br /> def initialize(host) @host = host; @perks = [] end<br /> def add(presenter)<br /> @perks.pushPerk.new(@host, presenter, 1, &quot;beer&quot;)<br /> end <br />end<br />class Perk<br />attr_reader :buyer, :receiver, :quantity, :item<br /> def initialize(buyer, receiver, quantity, item)<br /> @buyer = buyer; @receiver = receiver<br /> @quantity = quantity; @item = item<br /> end<br />end<br />
  17. 17. Execution<br /> Scenario: Brydon buys Declan beer<br />Given Brydon hosts DemoCampGuelph<br />When Declan demos Cucumber<br />Then Brydon should buy Declan 1 beer<br />Given /^(.+) hosts/ do |host|<br /> @event = Event.new(host)<br />End<br />When/^(.+) demos/ do |presenter|<br /> @event.add(presenter)<br />end<br />“Brydon”<br />Then/^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item|<br /> perk = @event.perks[0]; <br />perk.buyer.should == buyer; perk.receiver.should == drinker<br />perk.quantity.should == quantity.to_i; perk.item.should == item <br />end<br />
  18. 18. Execution<br /> Scenario: Brydon buys Declan beer<br />Given Brydon hosts DemoCampGuelph<br />When Declan demos Cucumber<br />Then Brydon should buy Declan 1 beer<br />Given /^(.+) hosts/ do |host|<br /> @event = Event.new(host)<br />End<br />When/^(.+) demos/ do |presenter|<br /> @event.add(presenter)<br />end<br />“Declan”<br />Then/^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item|<br /> perk = @event.perks[0]; <br />perk.buyer.should == buyer; perk.receiver.should == drinker<br />perk.quantity.should == quantity.to_i; perk.item.should == item <br />end<br />
  19. 19. Execution<br /> Scenario: Brydon buys Declan beer<br />Given Brydon hosts DemoCampGuelph<br />When Declan demos Cucumber<br />Then Brydon should buy Declan 1 beer<br />Given /^(.+) hosts/ do |host|<br /> @event = Event.new(host)<br />End<br />When/^(.+) demos/ do |presenter|<br /> @event.add(presenter)<br />end<br />Then/^(.+) should buy (.+) (d+) (.*)$/ do |buyer, drinker, qty, item|<br /> perk = @event.perks[0]; <br />perk.buyer.should == buyer; perk.receiver.should == drinker<br />perk.quantity.should == quantity.to_i; perk.item.should == item <br />end<br />
  20. 20. Spoken Languages<br />English Arabic Bulgarian Catalan Welsh Czech<br />Danish German Australian LOLCAT Texan<br />Spanish Estonian Finnish French Hebrew<br />Croatian Hungarian Indonesian Italian<br />Japanese Korean Lithuanian Latvian<br />Dutch Norwegian Polish Portuguese<br />Romanian Romanian-diacritical<br />Russian Swedish Uzbek Vietnamese<br />Chinese-simplified Chinese-traditional<br />
  21. 21. Cucumber Support<br />
  22. 22. More Stuff<br />http://cukes.info/<br />http://wiki.github.com/aslakhellesoy/cucumber<br />Declan Whelan<br />http://dpwhelan.com<br />http://twitter.com/dwhelan<br />

×