Introduction and Strategies     for Effective ATDD                      Agile Day – Twin Cities                           ...
Agenda●    Introduction to ATDD         ●             What it is         ●             How it works         ●             ...
Introduction to ATDD/BDD●    Acceptance Test Driven Development         ●             Pioneered with FIT/Fitnesse         ...
How ATDD/BDD Tools Work●    Typically 4 pieces          ●              A system to test!          ●              An ATDD/B...
An exampleScenario: Authentication within the                             @Given("an organization named $orgNames")timefra...
Common Challenges●    What to test – Unit vs System Testing         ●             Unit/Mock for exception handling        ...
Common Challenges●    How to Setup, Access and Verify the SUT         ●             Access different from Setup/Verify    ...
ATDD/BDD Testing Tools●    Open Source Frameworks/Tools          ●              FIT, Cucumber (ruby), JBehave (java), Lett...
ATDD/BDD Testing Tools●    Resource / System Stubs         ●             In-Memory, Lightweight Databases                 ...
Agile and ATDD●    Defines (and Proves!) “Done“          ●              Understood by everyone          ●              Ser...
Challenges / Strategies (1)●    My system depends on another system         ●             Just call it                    ...
Challenges / Strategies (2)●    I have a resource (printed receipt) that I    cant verify with code         ●             ...
Challenges / Strategies (3)●    Testing everything takes too much time         ●             Run the same story with diffe...
References●    Gojko Adzic          ●              “Bridging the Communication Gap”          ●              “Specification...
Q/A – Thank You!   Copyright 2011 LearnThinkCode, Inc.   This work is licensed under a Creative Commons Attribution-Noncom...
Upcoming SlideShare
Loading in...5
×

Agile Days Twin Cities 2011

887

Published on

Introduction and Strategies for Effective ATDD

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
887
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
23
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Agile Days Twin Cities 2011

  1. 1. Introduction and Strategies for Effective ATDD Agile Day – Twin Cities Nov 11, 2011 Brian Repko brian.repko@learnthinkcode.com Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  2. 2. Agenda● Introduction to ATDD ● What it is ● How it works ● Tools● Agile and ATDD● Three Challenges / Strategies Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  3. 3. Introduction to ATDD/BDD● Acceptance Test Driven Development ● Pioneered with FIT/Fitnesse ● System or Solution (multi-system) ● Readable and Executable Specifications ● Requires “Fixture” code● Behavior Driven Development ● Introduced by Dan North (2003) ● Early on, referred to as “TDD done well” ● Business language / Given-When-Then Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  4. 4. How ATDD/BDD Tools Work● Typically 4 pieces ● A system to test! ● An ATDD/BDD framework/tool ● Specifications/stories/tests (text/html) ● Fixtures/steps (code) ● Accessible to the framework ● Manipulates/verifies the system to test● Framework parses the story, calls methods in the steps code which manipulates/verifies the system● Most tools use regex matching to connect story text to steps methods and support befores/afters Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  5. 5. An exampleScenario: Authentication within the @Given("an organization named $orgNames")timeframe @Alias("organizations named $orgNames")Given an organization named Cisco public void createOrganizationWithName(List<String>And authentication policy for Cisco: orgNames) {|passwordAutoExpire|passwordExpiryDays| ...|true|30| }And the users for Cisco:|username|passwordCleartext| @Given("authentication policy for $orgName: $authPolicyTable")lastPasswordResetDate| public void|lenbosack|password|t-15| updateOrganizationWithDefaultAuthPolicy(String orgName, ExamplesTable table) {|sandylerner|password|t-45| …When current organization is Cisco }And user lenbosack authenticates withpassword passwordThen user should be authenticated Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  6. 6. Common Challenges● What to test – Unit vs System Testing ● Unit/Mock for exception handling ● Unit Testing – fast feedback ● System Testing – full functionality Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  7. 7. Common Challenges● How to Setup, Access and Verify the SUT ● Access different from Setup/Verify ● Need the System to support configuration Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  8. 8. ATDD/BDD Testing Tools● Open Source Frameworks/Tools ● FIT, Cucumber (ruby), JBehave (java), Lettuce (python), Behat (php), Spock (groovy), SpecFlow (.NET), EasyB (groovy), Concordian (java), *Spec, Thucydides ● Gherkin language for specifications ● Cucumber, Lettuce, SpecFlow, Behat - JBehave is close● Integration (invoking) Technologies ● Browser – Selenium, Wati*, iMacros, WebAii ● Java UI – UISpec4J, java.awt.Robot ● Web Services – curl, Jersey, CXF, SoapUI, HTTP Client Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  9. 9. ATDD/BDD Testing Tools● Resource / System Stubs ● In-Memory, Lightweight Databases ● H2, HSQLDB, OracleXE ● DbUnit, DbFIT (setup and verify) ● Messaging - ActiveMQ ● SMTP – DevNull● System Stubs ● Custom / Groovy-Grails● Environments ● SauceLabs ● Puppet / Chef / Vagrant Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  10. 10. Agile and ATDD● Defines (and Proves!) “Done“ ● Understood by everyone ● Serves as documentation● Test-first as part of story prep ● Add the specification but its not “on” ● Can run it without steps – PENDING● System and solution (multi-system) ● Test a configured system or set of systems● Part of Continuous Deployment pipeline ● Define stage gates in your pipeline ● Do varying types / amounts of tests Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  11. 11. Challenges / Strategies (1)● My system depends on another system ● Just call it ● Can you reuse step classes? ● Just stub it out ● Can you setup a mock in your system? ● Can you stub out the system? Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  12. 12. Challenges / Strategies (2)● I have a resource (printed receipt) that I cant verify with code ● Take the API that access the resource ● Write/Create a “delegating wrapper” ● The wrapper will record all method calls ● Connect with the wrapper to verify Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  13. 13. Challenges / Strategies (3)● Testing everything takes too much time ● Run the same story with different steps ● Step classes that drive the UI (slow) ● Step classes that run in the JVM / services ● 80/20 rule (change vs nightly) ● Fail-Fast strategy ● Parallelization Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  14. 14. References● Gojko Adzic ● “Bridging the Communication Gap” ● “Specification by Example”● FIT - http://fit.c2.com● Fitnesse - http://fitnesse.org● Cucumber - http://cukes.info● JBehave – http://jbehave.org● SpecFlow - http://specflow.org/● Spock - http://code.google.com/p/spock/ Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  15. 15. Q/A – Thank You! Copyright 2011 LearnThinkCode, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×