28 September 2011<br />© Agile Institute 2011<br />1<br />Café<br />Successful Teams are TDD Teams<br />Rob Myers<br />for...
28 September 2011<br />© Agile Institute 2011<br />2<br />
Debt<br />Quality Debt<br />Defects<br />Design Debt<br />Resists change<br />Testing Debt<br />Full regression time<br />...
Page 4<br />Interface-Centric Tools<br />
28 September 2011<br />© Agile Institute 2011<br />5<br />from<br />XP<br />to<br />ATDD<br />&<br />BDD<br />
“Move Mount Fuji”<br />28 September 2011<br />6<br />© Agile Institute 2011<br />
28 September 2011<br />© Rob Myers 2011<br />7<br />
Two Great Flavors<br />TDD<br />Each test pins down technical behavior.<br />Written by developers.<br />For developers.<b...
28 September 2011<br />© Agile Institute 2011<br />9<br />Distill<br />As Bart Bookworm I want to be told when new release...
Page 10<br />Business-Value-Centric Tool<br />
28 September 2011<br />© Agile Institute 2011<br />11<br />As Bart Bookworm, I get a free BookClub book for every three Bo...
Page 12<br />Cucumber/JBehave/…<br />Feature: Search courses <br />As Bart Bookworm, I get a free BookClub book for every ...
Page 13<br />What ATDD tools do<br />Your test (human-readable)<br />Test-run report<br />Tool framework<br />Simple trans...
28 September 2011<br />© Agile Institute 2011<br />14<br />TDD<br />
28 September 2011<br />© Agile Institute 2011<br />15<br />Unit testing is sooooDEPRESSING<br />
28 September 2011<br />© Agile Institute 2011<br />16<br />TDD is fun,<br />and provides much more than just unit-tests!<b...
28 September 2011<br />© Agile Institute 2011<br />17<br />“The results of the case studies indicate that the pre-release ...
28 September 2011<br />© Agile Institute 2011<br />18<br />
28 September 2011<br />© Agile Institute 2011<br />19<br />discipline<br />
28 September 2011<br />© Agile Institute 2011<br />20<br />#1<br />automation<br />public static void Main() {<br />Consol...
28 September 2011<br />© Agile Institute 2011<br />21<br />#2<br />Test-First<br />We write a test before writing the code...
28 September 2011<br />© Agile Institute 2011<br />22<br />#3<br />Any behavior-preserving change that improves maintainab...
28 September 2011<br />© Agile Institute 2011<br />23<br />#4<br />Mock Objects<br />
Prep road-data for new Mars Colony Road/Canal Service<br /><ul><li> Build ‘Earth’ adapter around map-data service
Refactor all callers to use Earth (all?)
Extract abstract  parent ‘Planet’
Planet needs a factory
Test that Mars adapter calls new Mars-map service (mock the service)
Upcoming SlideShare
Loading in...5
×

Successful Teams are TDD Teams

1,000

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

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

No notes for slide
  • Problem: Iterations imply incremental developmentChange can result in a negative feedback loop - ENTROPY: The Agilist’s DilemmaWe have to address this. It’s not easy, until it becomes easy. At first, we’d rather not check the oil…
  • This is how we usually see our software. We point-click-type-point-click-type.Anything wrong with this?SlowDifficult to set upNumerous failures from one defect, &amp; Failures do not identify the defectSoftware has to be DONE FIRST!
  • Codified by Kent Beck.From his XP practices.Led to automated unit-test frameworks and refactoring tools.Adapted by Agilists into two distinct practices.
  • Imagine if you could get past the UI and snoop around anywhere within the system? What would you do with your newfound freedom? Test what’s important. This is not unit-testing. Think of it as conceptual coverage. What if you didn’t know (or care) what section of CODE you’re testing, but what STORY (BUSINESS VALUE).Not “Test the database” but “Test that user data gets stored safely and accurately.”Not “test the 3rd party web service connection” but “Test that we interact correctly with our partners.”You don’t have to imagine. Such tools exist.
  • This is an example in Cucumber. &lt;pause&gt;Cucumber allows you to express acceptance tests (examples) in natural language. The team will have to eventually settle on some common syntax and terminology. Effectively, Cucumber helps the team build a Domain-Specific Language, particularly if they work to express the essence of the test, without excessive concern for technological limitations. You may be wondering “How in the world are we going to automate this?!” If so, I’m going to ask you to suspend your disbelief. Other training modules will cover the details of what we need to do to get this to work. Suffice it to say that it will be much easier than you may think.
  • NW story: Can’t do TDD, they haven’t even figured out unit tests yet!
  • TDD is easier.My personal goal is to show you Robbie’s point of view. Perhaps you’ll make it your own.
  • Does TDD Work?Microsoft and IBM…Also, “approximately 40% fewer defects” Laurie Williams for ACMdefect rate is considerably lowerfuture enhancements easierin a dynamic market. defects quickly detected
  • Story 15 years old, at least (Phoenix).Truck stuck.Fire dept and others arrive and try to figure out what to do.Anecdotally, a young man walks up and says “Why not deflate the tires?”Developers can think about a problem and come up with a possible solution.BUT…first specify the question (Jeopardy-style)
  • A habit…We still use when times are tough…Because we know there is a long-term benefit.Habit: 30-days, support-groupBenefits org, team, individualDiscipline prevents regret (debt).
  • SolutionFastRepeatable resultsBetter than…
  • Solution:… Actors
  • Simple, emergent design.Kent Beck.
  • Weinberg’s “Are Your Lights On?” Golden ______OTIS2 data conversionOTIS2 “GUI” conversionDenali Internationalization
  • Thank you!
  • Roadblocks to AdoptionDevelopers skip refactoring, don’t spend the minute to look for and clean up a new bit of code duplication.Inexperienced coaches who confuse the developer-style TDD with the team ATDDManagers waffling over the use of TDD, which limits its effectiveness…and others.
  • One Analogy for the DesignThe suite of tests preserves all prior behavior while we address design, allowing for Emergent Designs
  • AnAnalogy for theProgrammer:Each test remains as an individual investment in the behavior and the quality of the design
  • Successful Teams are TDD Teams

    1. 1. 28 September 2011<br />© Agile Institute 2011<br />1<br />Café<br />Successful Teams are TDD Teams<br />Rob Myers<br />for<br />BayALN<br />27 Sep 2011<br />
    2. 2. 28 September 2011<br />© Agile Institute 2011<br />2<br />
    3. 3. Debt<br />Quality Debt<br />Defects<br />Design Debt<br />Resists change<br />Testing Debt<br />Full regression time<br />28 September 2011<br />© Agile Institute 2011<br />3<br />http://tinyurl.com/dx2dka<br />
    4. 4. Page 4<br />Interface-Centric Tools<br />
    5. 5. 28 September 2011<br />© Agile Institute 2011<br />5<br />from<br />XP<br />to<br />ATDD<br />&<br />BDD<br />
    6. 6. “Move Mount Fuji”<br />28 September 2011<br />6<br />© Agile Institute 2011<br />
    7. 7. 28 September 2011<br />© Rob Myers 2011<br />7<br />
    8. 8. Two Great Flavors<br />TDD<br />Each test pins down technical behavior.<br />Written by developers.<br />For developers.<br />Run frequently by the team.<br />All tests pass 100% before commit and at integration.<br />ATDD<br />Each test pins down a business rule.<br />Written by the team.<br />For the team.<br />Run frequently by the team.<br />New tests fail until the story is done. Prior tests should all pass.<br />28 September 2011<br />© Agile Institute 2011<br />8<br />“Peanut Butter Cup” by Laura Godi<br />
    9. 9. 28 September 2011<br />© Agile Institute 2011<br />9<br />Distill<br />As Bart Bookworm I want to be told when new releases are available at a discount…<br />Discuss<br />The ATDD<br />Cycle<br />Develop<br />TDD<br />Demonstrate<br />
    10. 10. Page 10<br />Business-Value-Centric Tool<br />
    11. 11. 28 September 2011<br />© Agile Institute 2011<br />11<br />As Bart Bookworm, I get a free BookClub book for every three BookClub selections I buy in a month.<br />Cheapest book wins!<br />
    12. 12. Page 12<br />Cucumber/JBehave/…<br />Feature: Search courses <br />As Bart Bookworm, I get a free BookClub book for every three BookClub selections I buy in a month. Cheapest book wins.<br />Scenario: During a single shopping experience<br />Given I am Bart Bookworm<br />And I select “Hitchhiker’s Guide” for $11.95 from the BookClub<br />And I select “Star Wars” for $3.95 from the BookClub<br />And I select “Neutron Star” for $4.50 from the BookClub<br />And I select “Across Realtime” for $6.50 from the BookClub<br />When I view my shopping cart <br />Then the discount for “Star Wars” is $3.95 <br />
    13. 13. Page 13<br />What ATDD tools do<br />Your test (human-readable)<br />Test-run report<br />Tool framework<br />Simple translation layer<br />(test code)<br />System Under Test<br />
    14. 14. 28 September 2011<br />© Agile Institute 2011<br />14<br />TDD<br />
    15. 15. 28 September 2011<br />© Agile Institute 2011<br />15<br />Unit testing is sooooDEPRESSING<br />
    16. 16. 28 September 2011<br />© Agile Institute 2011<br />16<br />TDD is fun,<br />and provides much more than just unit-tests!<br />
    17. 17. 28 September 2011<br />© Agile Institute 2011<br />17<br />“The results of the case studies indicate that the pre-release defect density of the four products decreased between 40% and 90% relative to similar projects that did not use the TDD practice. Subjectively, the teams experienced a 15–35% increase in initial development time after adopting TDD.”<br />http://research.microsoft.com/en-us/projects/esm/nagappan_tdd.pdf, Nagappan et al, © Springer Science + Business Media, LLC 2008<br />
    18. 18. 28 September 2011<br />© Agile Institute 2011<br />18<br />
    19. 19. 28 September 2011<br />© Agile Institute 2011<br />19<br />discipline<br />
    20. 20. 28 September 2011<br />© Agile Institute 2011<br />20<br />#1<br />automation<br />public static void Main() {<br />Console.WriteLine(<br /> “I sure hope this works...” +<br />myObject.Foo());<br />}<br />
    21. 21. 28 September 2011<br />© Agile Institute 2011<br />21<br />#2<br />Test-First<br />We write a test before writing the code that makes it pass.<br />
    22. 22. 28 September 2011<br />© Agile Institute 2011<br />22<br />#3<br />Any behavior-preserving change that improves maintainability.<br />
    23. 23. 28 September 2011<br />© Agile Institute 2011<br />23<br />#4<br />Mock Objects<br />
    24. 24. Prep road-data for new Mars Colony Road/Canal Service<br /><ul><li> Build ‘Earth’ adapter around map-data service
    25. 25. Refactor all callers to use Earth (all?)
    26. 26. Extract abstract parent ‘Planet’
    27. 27. Planet needs a factory
    28. 28. Test that Mars adapter calls new Mars-map service (mock the service)
    29. 29. Test that Planet factory determines which planet client is on (mock config file)</li></ul>28 September 2011<br />© Agile Institute 2011<br />24<br />#5<br />A To-Do List<br />
    30. 30. 28 September 2011<br />© Agile Institute 2011<br />25<br />steps<br />Write oneunit test.<br />Build or add to the object under test until everything compiles.<br />Red: Watch the test fail!<br />Green: Make all the tests pass by changing the object under test.<br />Clean: Refactormercilessly!<br />Repeat.<br />
    31. 31. 28 September 2011<br />© Agile Institute 2011<br />26<br />Runs all the tests.<br />Expresses every idea required.<br />Says everything once and only once.<br />Has no superfluous parts.<br />
    32. 32. 28 September 2011<br />© Agile Institute 2011<br />27<br />EMERGENT<br />DESIGN<br />
    33. 33. 28 September 2011<br />© Agile Institute 2011<br />28<br />real value<br />
    34. 34. 28 September 2011<br />© Agile Institute 2011<br />29<br /> Rob.Myers@agileInstitute.com<br />http://PowersOfTwo.agileInstitute.com/<br />
    35. 35. 28 September 2011<br />© Agile Institute 2011<br />30<br />roadblocks<br />
    36. 36. 28 September 2011<br />© Agile Institute 2011<br />31<br />architectural<br />perspective<br />
    37. 37. 28 September 2011<br />© Agile Institute 2011<br />32<br />Analogies & Metaphors<br />
    38. 38. 28 September 2011<br />© Agile Institute 2011<br />33<br />
    39. 39. 28 September 2011<br />© Agile Institute 2011<br />34<br />

    ×