• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Executable Requirements with Behaviour-Driven Development and Cucumber - EuroSTAR 2009
 

Executable Requirements with Behaviour-Driven Development and Cucumber - EuroSTAR 2009

on

  • 4,611 views

An intro to BDD and Cucumber

An intro to BDD and Cucumber

Statistics

Views

Total Views
4,611
Views on SlideShare
4,579
Embed Views
32

Actions

Likes
11
Downloads
161
Comments
0

5 Embeds 32

http://www.slideshare.net 25
http://www.linkedin.com 4
http://www.lmodules.com 1
http://www.mefeedia.com 1
http://www.pinterest.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution License

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
  • BEKK - Consulting <br /> Agile 2002 <br /> Open Source 2001 <br /> Author of Cucumber <br /> Free, open source BDD <br /> Slides different (Dorothy) - will upload to Slideshare and tweet.
  • Cucumber based on BDD <br /> Reframing of TDD - test before code <br /> Requirements before code <br /> Communication via examples <br /> Automation
  • Getting the words right <br /> Examples later
  • Never lose track of business value (WHY) <br /> Verification all the time
  • Requirement <br /> Use Case
  • How to test? <br /> How to develop?
  • How to test? <br /> How to develop?
  • How to test? <br /> How to develop?
  • Lack of this: <br /> Common reason for failure and delay
  • Unambiguous ones
  • Detailed requirement <br /> This is also a test <br /> Written before code <br /> Automated
  • Translate to Cucumber test
  • Leading BDD tool <br /> Dozens of clones <br /> 1 year old - mature <br /> Mindblowing
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Big ecosystem <br /> By far the most popular BDD tool out there
  • Print this month
  • Written in Ruby <br /> Ruby is 16 - can sleep with other languages <br /> See all the JVM ones?
  • All the JVM language support
  • Language - you have seen a little <br /> What the testers use <br /> I will show you the language features <br /> AND the flow of usage
  • Icon means Gherkin <br /> Remember the user story? <br /> (Different example) <br /> English as native language?
  • Who has cats <br /> Keywords are translated <br /> 38 languages <br /> Reason it&#x2019;s popular <br /> Samisk
  • Who has cats <br /> Keywords are translated <br /> 38 languages <br /> Reason it&#x2019;s popular <br /> Samisk
  • Who has cats <br /> Keywords are translated <br /> 38 languages <br /> Reason it&#x2019;s popular <br /> Samisk
  • Language - you have seen a little <br /> Treetop <br /> Ragel <br /> Show the res of the language <br /> Simple - for biz
  • At the root of your project
  • Run it
  • Scroll down
  • Past the code <br /> Can be Java, Scala, Groovy, C# etc.
  • The programmers hook it up to the code. <br /> Code doesn&#x2019;t exist yet.
  • We fix it
  • LEARN REGEXP <br /> AS MANY AS YOU WANT <br /> SAME NUMBER <br /> GENERATED FOR YOU
  • Mastermind game
  • Python string <br /> Exception to previous rule. Extra stepdef arg
  • Store in Hibernate? <br /> Diff <br /> Hashes <br /> Raw <br /> Transpose <br /> Map cols and rows
  • JUnit handy for Hudson
  • Incredible what people tweet about #cucumber <br /> (Not all of it related to the tool) <br /> Salad and drinks <br /> Some other things :-)

Executable Requirements with Behaviour-Driven Development and Cucumber - EuroSTAR 2009 Executable Requirements with Behaviour-Driven Development and Cucumber - EuroSTAR 2009 Presentation Transcript

  • Executable Requirements with BDD and http://cukes.info/ Aslak Hellesøy - Chief Scientist @aslak_hellesoy aslak.hellesoy@gmail.com
  • BDD: Dual audience Stakeholders Testers Users Programmers
  • UBIQUITOUS
  • Outside in
  • User Story
  • User Story Sign up In order to avoid manual work participants should be able to sign up on the web
  • User Story Sign up In order to avoid manual work participants should be able to sign up on the web
  • User Story Sign up In order to avoid manual work participants should be able to sign up on the web
  • User Story Sign up In order to avoid manual work participants should be able to sign up on the web
  • Common understanding of Done
  • Acceptance
  • Acceptance Given I am on the signup page And I have filled in the form When I click “sign up” Then I should get email confirm. Given... When... Then...
  • Acceptance They are examples! Given I am on the signup page And I have filled in the form When I click “sign up” Then I should get email confirm. Given... When... Then...
  • Acceptance
  • http://cukes.info/
  • http://www.flickr.com/photos/twose/887903401/
  • http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads 1550 followers http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads 1550 followers 180 contributors http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads 1550 followers 180 contributors 65 wiki pages http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads 1550 followers 180 contributors 65 wiki pages 40 tools http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads 1550 followers 180 contributors 65 wiki pages 40 tools 20 screencasts http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads 1550 followers 180 contributors 65 wiki pages 40 tools 20 screencasts 60 in #cucumber http://www.flickr.com/photos/twose/887903401/
  • 80000 downloads 1550 followers 180 contributors 65 wiki pages 40 tools 20 screencasts 60 in #cucumber #7 on Github http://www.flickr.com/photos/twose/887903401/
  • Javascript Next:
  • Cuke4Duke
  • Gherkin (language)
  • # language: en Feature: Division In order to avoid silly mistakes Cashiers must be able to calculate a fraction Scenario: Regular numbers Given I have entered 3 into the calculator And I have entered 2 into the calculator When I press divide Then the result should be 1.5 on the screen
  • # language: ja : : 3 2 divide 1.5
  • OH HAI: STUFFING MISHUN: CUCUMBR I CAN HAZ IN TEH BEGINNIN "3" CUCUMBRZ WEN I EAT "2" CUCUMBRZ DEN I HAZ "2" CUCUMBERZ IN MAH BELLY AN IN TEH END "1" CUCUMBRZ KTHXBAI!
  • # language: no Egenskap: Summering For å slippe å gjøre dumme feil Som en regnskapsfører Vil jeg kunne legge sammen Scenario: to tall Gitt at jeg har tastet inn 5 Og at jeg har tastet inn 7 Når jeg summerer Så skal resultatet være 12
  • magyar български Bahasa Indonesia català italiano Cymraeg lietuvių kalba русский Česky latviešu Svenska dansk Nederlands Slovensky Deutsch norsk Узбекча English polski Tiếng Việt Australian português LOLCAT română Texan suomi español français ‫עברית‬ eesti keel hrvatski ‫ﺍﻟﻌﺮﺑﻴﺔ‬
  • features division.feature
  • $ cucumber features/division.feature # language: en Feature: Division In order to avoid silly mistakes Cashiers must be able to calculate a fraction Scenario: Regular numbers # features/division.feature:6 Given I have entered 3 into the calculator # features/division.feature:7 And I have entered 2 into the calculator # features/division.feature:8 When I press divide # features/division.feature:9 Then the result should be 1.5 on the screen # features/division.feature:10 1 scenario (1 undefined) 4 steps (4 undefined) 0m0.005s
  • You can implement step definitions for undefined steps with these snippets: Given /^I have entered 3 into the calculator$/ do pending end Given /^I have entered 2 into the calculator$/ do pending end When /^I press divide$/ do pending end Then /^the result should be 1.5 on the screen$/ do pending end If you want snippets in a different programming language, just make sure a file with the appropriate file extension exists where cucumber looks for step definitions.
  • features division.feature step_definitions calculator_steps.rb
  • Given /I have entered (d+) into the calculator/ do |n| @calc.push n.to_i end When /I press (w+)/ do |op| @result = @calc.send op end Then /the result should be (.*) on the screen/ do |result| @result.should == result.to_f end
  • features division.feature step_definitions calculator_steps.rb lib calculator.rb
  • $ cucumber features/division.feature # language: en Feature: Division In order to avoid silly mistakes Cashiers must be able to calculate a fraction Scenario: Regular numbers # features/division.feature:6 Given I have entered 3 into the calculator # features/step_definitons/calculator_steps.rb:14 And I have entered 2 into the calculator # features/step_definitons/calculator_steps.rb:14 When I press divide # features/step_definitons/calculator_steps.rb:18 Then the result should be 1.5 on the screen # features/step_definitons/calculator_steps.rb:22 1 scenario (1 passed) 4 steps (4 passed) 0m0.005s
  • Steps & Step Given the secret code is "r g y c" @Given("^the secret code is "([^"]*)"$") public void theSecretCodeIs(String code) { game = new Game(code); }
  • Scenario Outline Scenario Outline: submit guess Given the secret code is "<code>" When I guess "<guess>" Then the mark should be "<mark>" Examples: | code | guess | mark | | r g y c | r g y c | bbbb | | r g y c | r g c y | bbww | | r g y c | y r g c | bwww | | r g y c | c r g y | wwww |
  • Multiline args (String) Then aslak.hellesoy@gmail.com should get email """ Hi aslak.hellesoy@gmail.com Congratulations, Cucumberer was accepted. See you at JavaZone! """ @Then("^(.*) should get email$") public void email(String email, String body) { }
  • Multiline args (Tables) Given the following proposals | email | title | | aslak.hellesoy@gmail.com | Cucumber | | bryan@brynary.com | Webrat | @Given("^the following proposals$") public void proposals(cuke4duke.Table proposals) { }
  • Background Feature: Notification emails Background: Given the following proposals exist | email | title | | aslak.hellesoy@gmail.com | Cucumber | | bryan@brynary.com | Webrat | Scenario: Approve all Scenario: Reject Webrat
  • Tags Feature: Take over the world I want it all @spanish @french @english Scenario: Take over Europe @spanish @english Scenario: Take over America @english Scenario: Take over Australia
  • Tags cucumber -t spanish doit.feature Feature: Take over the world I want it all @spanish @french @english Scenario: Take over Europe @spanish @english Scenario: Take over America @english Scenario: Take over Australia
  • Tags Feature: Take over the world I want it all @spanish @french @english Scenario: Take over Europe @spanish @english Scenario: Take over America @english Scenario: Take over Australia
  • Tags cucumber -t ~french doit.feature Feature: Take over the world I want it all @spanish @french @english Scenario: Take over Europe @spanish @english Scenario: Take over America @english Scenario: Take over Australia
  • Formatters Pretty Progress Profile HTML JUnit Rerun Your Own
  • http://cukes.info/ @aslak_hellesoy #cucumber