The Only Way to Test!

1,163 views

Published on

Talk given to Sydney Ruby (a.k.a. rorosyd) on 8 July, 2014. Inspired by the discussions that ensued from DHH's provocative pronouncement that "TDD is Dead".

Published in: Software, Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,163
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
6
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

The Only Way to Test!

  1. 1. “The Only Way to Test!” Keith Pitty ! @keithpitty
  2. 2. Who’s telling you the right way to test?
  3. 3. So… who is right?
  4. 4. Let’s engage our brains!
  5. 5. What’s being posited?
  6. 6. James Coplien: “Why Most Unit Testing is Waste” Comprehensive, well-argued article Well worth reading with an open mind May challenge your preconceptions
  7. 7. James Coplien: “Why Most Unit Testing is Waste” “Keep unit tests that test key algorithms for which there is a broad, formal, independent oracle of correctness, and for which there is ascribable business value.”
  8. 8. James Coplien: “Why Most Unit Testing is Waste” “Throw away tests that haven’t failed in a year.”
  9. 9. James Coplien: “Why Most Unit Testing is Waste” “Be humble about what tests can achieve. Tests don’t improve quality: developers do.”
  10. 10. Bob Martin: “Monogamous TDD” argues that TDD does have significant value
  11. 11. Bob Martin: “Monogamous TDD” trustworthy, fast test suite fearless, quick code cleaning
  12. 12. Gary Bernhardt: “TDD, Straw Men, and Rhetoric” aims for test feedback in 300ms
  13. 13. Gary Bernhardt: “TDD, Straw Men, and Rhetoric” tests respond before he has time to think
  14. 14. Gary Bernhardt: “TDD, Straw Men, and Rhetoric” “TDD is useful and test isolation is useful, but they both involve making trade-offs.”
  15. 15. Corey Haines: “Speeding Up ActiveRecord Tests" Specific suggestion to speed up ActiveRecord tests using his active_record_spec_helper
  16. 16. Corey Haines: “Speeding Up ActiveRecord Tests" Isolation: only include the parts of the system that are necessary
  17. 17. Martin Fowler, Kent Beck & DHH: “Is TDD Dead?” Five discussions totally about three hours
  18. 18. Martin Fowler, Kent Beck & DHH: “1. TDD and Confidence” KB: TDD can, but does not necessarily, lead to flow DHH: doesn’t like the conflation of TDD and confidence from self-testing code MF: heavy mocking isn’t mandatory in TDD
  19. 19. Martin Fowler, Kent Beck & DHH: “2. Test-induced design damage” KB to DHH: “TDD isn’t taking you anywhere. You’re making the decisions.”
  20. 20. Martin Fowler, Kent Beck & DHH: “3. Feedback and QA” MF: categories of feedback: 1. user needs 2. regression tests 3. healthy codebase DHH: notion of criticality KB: it’s a continuum and set of trade-offs
  21. 21. Martin Fowler, Kent Beck & DHH: “3. Feedback and QA” “As soon as you think you’re not making mistakes, you’re making mistakes.” — Kent Beck
  22. 22. Martin Fowler, Kent Beck & DHH: “4. Costs of Testing” DHH: some tests are not justified KB: delta coverage MF: only test things that could possibly break DHH: insufficient energy in refactoring
  23. 23. Martin Fowler, Kent Beck & DHH: “5. Q & A; Summary” KB: TDD helps problems to be broken down MF: TDD with refactoring has often led to good design DHH: “most people cannot leave good ideas the fuck alone”
  24. 24. Martin Fowler, Kent Beck & DHH: “5. Summary” KB: TDD is not dead but thanks for setting fire to it DHH: TDD shouldn’t be mandated but we don’t want to lose self-testing code MF: if you’re going to be involved in software development you have to be thoughtful
  25. 25. What do I think?
  26. 26. important to appreciate each other’s different experiences
  27. 27. I value TDD in some situations
  28. 28. I also value other forms of feedback
  29. 29. I sometimes write regression tests last
  30. 30. I think it’s always important to consider how valuable a test is
  31. 31. I know I still have a lot to learn
  32. 32. What do you think?
  33. 33. In summary…
  34. 34. Learn from others
  35. 35. Consider the context
  36. 36. Think for yourself!
  37. 37. References • http://david.heinemeierhansson.com/2014/tdd-is-dead-long-live-testing.html • http://david.heinemeierhansson.com/2014/slow-database-test-fallacy.html • http://www.rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste.pdf • http://blog.8thlight.com/uncle-bob/2014/04/25/MonogamousTDD.html • https://www.destroyallsoftware.com/blog/2014/tdd-straw-men-and-rhetoric • http://articles.coreyhaines.com/posts/active-record-spec-helper/ • http://martinfowler.com/articles/is-tdd-dead/
  38. 38. More References • “Growing Object-Oriented Software, Guided by Tests”, Steve Freeman & Nat Price • “Rails 4 Test Prescriptions: Build a Healthy Codebase”, Noel Rappin • “Perfect Software and other illusions about testing”, Gerald M. Weinberg
  39. 39. Thanks for listening

×