1. Test Driven
Development
Pittsburgh Agile Group
May 24, 2011
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
2. Our Tests
It == This Presentation
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
3. Our Tests
It == This Presentation
• it should define TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
4. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
5. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
6. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
7. What is TDD?
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
8. What is TDD?
• Simple, high-feedback incremental coding
technique
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
9. What is TDD?
• Simple, high-feedback incremental coding
technique
• Write tests as specs prior to code
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
10. What is TDD?
• Simple, high-feedback incremental coding
technique
• Write tests as specs prior to code
• Immediate feedback
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
11. Core of the cycle
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
12. History of TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
13. History of TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
14. History of TDD
• Devised by Ward
Cunningham
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
15. History of TDD
• Devised by Ward
Cunningham
• Honed by Kent Beck
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
16. History of TDD
• Devised by Ward
Cunningham
• Honed by Kent Beck
• Incorporated as one of XP’s
practices
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
17. History of TDD
• Devised by Ward
Cunningham
• Honed by Kent Beck
• Incorporated as one of XP’s
practices
• Buzzword History
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
18. History of TDD
• Devised by Ward
Cunningham
• Honed by Kent Beck
• Incorporated as one of XP’s
practices
• Buzzword History
• Test-first programming
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
19. History of TDD
• Devised by Ward
Cunningham
• Honed by Kent Beck
• Incorporated as one of XP’s
practices
• Buzzword History
• Test-first programming
• Test-first design
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
20. History of TDD
• Devised by Ward
Cunningham
• Honed by Kent Beck
• Incorporated as one of XP’s
practices
• Buzzword History
• Test-first programming
• Test-first design
• Test-driven development
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
21. TDD and Testing
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
22. TDD and Testing
• Creates testable code
by definition
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
23. TDD and Testing
• Creates testable code
by definition
• Obvious but significant
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
24. TDD and Testing
• Creates testable code
by definition
• Obvious but significant
• Writing tests after code
built is much harder
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
25. TDD and Testing
• Creates testable code
by definition
• Obvious but significant
• Writing tests after code
built is much harder
• Therefore fewer tests
get written
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
26. TDD and Testing
• Creates testable code
by definition
• Obvious but significant
• Writing tests after code
built is much harder
• Therefore fewer tests
get written
• Minimizes defects
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
27. More Importantly...
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
28. More Importantly...
• Promotes better design
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
29. More Importantly...
• Promotes better design
• Teaches you how to design isolated classes
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
30. More Importantly...
• Promotes better design
• Teaches you how to design isolated classes
• Creates comprehensive developer
documentation
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
31. More Importantly...
• Promotes better design
• Teaches you how to design isolated classes
• Creates comprehensive developer
documentation
• Development Pacing
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
32. TDD Rules
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
33. TDD Rules
• Test everything that
could possibly break
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
34. TDD Rules
• Test everything that
could possibly break
• Do not write any
production code until
you have a failing test
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
35. TDD Rules
• Test everything that
could possibly break
• Do not write any
production code until
you have a failing test
• Code is not checked
in until 100% of unit
tests run
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
36. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
37. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
38. Why does it work?
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
39. Why does it work?
Pleasure spiked with Pain!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
40. Why does it work?
Pleasure spiked with Pain!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
41. Why does it work?
Pleasure spiked with Pain!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
42. Long Methods
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
43. Long Methods
Pain!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
44. Many Dependencies
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
45. Many Dependencies
Pain!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
46. Doing too much
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
47. Doing too much
Pain!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
48. Keep it clean
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
49. Keep it clean
Pleasure
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
50. Feel good
Pleasure
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
51. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
52. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
53. Nature
^
F
T>
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
54. Nature
X
^
F
T>
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
55. Nature
X
^
F
T>
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
56. Nature
X
^
F
T>
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
57. Nature
X
^
F
T>
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
58. Nature
X
^
F
T>
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
59. Design Evolves
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
60. Design Evolves
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
61. Design Evolves
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
62. Design Evolves
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
63. Design Evolves
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
64. Design Evolves
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
66. We Do Scrum!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
67. We Do Scrum!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
68. We Do Scrum!
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
69. Professionalism
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
70. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
71. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
72. Demo Time
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
73. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
74. Our Tests
It == This Presentation
• it should define TDD
• it should explain why TDD works
• it should explain why you should do TDD
• it should demonstrate TDD
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
75. Final Thoughts
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
76. Final Thoughts
• TDD is here to stay
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
77. Final Thoughts
• TDD is here to stay
• A satisfying and enriching practice that can
dramatically increase the quality of your
application
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
78. Final Thoughts
• TDD is here to stay
• A satisfying and enriching practice that can
dramatically increase the quality of your
application
• Diligent adherence to practice is required
to succeed
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
79. Final Thoughts
• TDD is here to stay
• A satisfying and enriching practice that can
dramatically increase the quality of your
application
• Diligent adherence to practice is required
to succeed
• But the benefits are worth it
Copyright 2011 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.