• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
891
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    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, & 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. <pause>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

Transcript

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