Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Test Driven Development

Test Driven Development

Intro to Testing, TDD, with many GIFs sprinkled in. Given at http://boston.io on 2/4/2012, UBHacking on 3/24/2012, and at RIT's ViSE program on 4/13/2012.

Nick Quaranto

February 06, 2012
Tweet

More Decks by Nick Quaranto

Other Decks in Programming

Transcript

  1. TEST
    DRIVEN
    DEVELOPMENT

    View full-size slide

  2. i’m @qrush

    View full-size slide

  3. @
    i live here

    View full-size slide

  4. c
    i work at 37signals

    View full-size slide

  5. test-driven!

    View full-size slide

  6. what
    is
    testing?

    View full-size slide

  7. REFRESHING
    COMPILING
    FOR SOMEONE
    ELSE TO DO
    not:

    View full-size slide

  8. TESTING
    DEFINES HOW
    YOUR CODE
    WORKS

    View full-size slide

  9. why should
    i test?

    View full-size slide

  10. PREDICTABILITY

    View full-size slide

  11. TIGHTER
    FEEDBACK
    LOOPS

    View full-size slide

  12. DEPENDABILITY

    View full-size slide

  13. LOOSE COUPLING

    View full-size slide

  14. how do
    you test
    something?

    View full-size slide

  15. PICK ANY
    LANGUAGE

    View full-size slide

  16. PICK ANY
    FRAMEWORK

    View full-size slide

  17. SAME
    STEPS
    SAME
    PATTERNS

    View full-size slide

  18. setup
    exercise
    verification
    teardown

    View full-size slide

  19. WRITE TESTS
    FIRST

    View full-size slide

  20. WRITE NEW
    CODE ONLY
    ON TEST
    FAILURE

    View full-size slide

  21. write a test
    watch it fail
    make it pass
    repeat

    View full-size slide

  22. red
    green
    refactor

    View full-size slide

  23. does this
    take longer?

    View full-size slide

  24. INITIALLY,
    BUT IT
    CAUSES
    LESS BUGS*
    * http://bit.ly/nugeo

    View full-size slide

  25. does this
    suck
    sometimes?

    View full-size slide

  26. BUT IT
    PROVIDES
    CONFIDENCE

    View full-size slide

  27. is it ok
    not to test?

    View full-size slide

  28. BUT
    THROW
    IT AWAY

    View full-size slide

  29. FIND A
    JOB*
    THAT HELPS
    YOU TEST

    View full-size slide

  30. ASK
    ABOUT
    POLICIES ON
    TESTING

    View full-size slide

  31. GO
    TEST
    YOUR CODE!

    View full-size slide