the only way to test!

Download The Only Way to Test!

Post on 28-Aug-2014

374 views

Category:

Software

2 download

Embed Size (px)

DESCRIPTION

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".

TRANSCRIPT

  • The Only Way to Test! Keith Pitty ! @keithpitty
  • Whos telling you the right way to test?
  • So who is right?
  • Lets engage our brains!
  • Whats being posited?
  • James Coplien: Why Most Unit Testing is Waste Comprehensive, well-argued article Well worth reading with an open mind May challenge your preconceptions
  • 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.
  • James Coplien: Why Most Unit Testing is Waste Throw away tests that havent failed in a year.
  • James Coplien: Why Most Unit Testing is Waste Be humble about what tests can achieve. Tests dont improve quality: developers do.
  • Bob Martin: Monogamous TDD argues that TDD does have signicant value
  • Bob Martin: Monogamous TDD trustworthy, fast test suite fearless, quick code cleaning
  • Gary Bernhardt: TDD, Straw Men, and Rhetoric aims for test feedback in 300ms
  • Gary Bernhardt: TDD, Straw Men, and Rhetoric tests respond before he has time to think
  • Gary Bernhardt: TDD, Straw Men, and Rhetoric TDD is useful and test isolation is useful, but they both involve making trade-offs.
  • Corey Haines: Speeding Up ActiveRecord Tests" Specic suggestion to speed up ActiveRecord tests using his active_record_spec_helper
  • Corey Haines: Speeding Up ActiveRecord Tests" Isolation: only include the parts of the system that are necessary
  • Martin Fowler, Kent Beck & DHH: Is TDD Dead? Five discussions totally about three hours
  • Martin Fowler, Kent Beck & DHH: 1. TDD and Condence KB: TDD can, but does not necessarily, lead to ow DHH: doesnt like the conation of TDD and condence from self-testing code MF: heavy mocking isnt mandatory in TDD
  • Martin Fowler, Kent Beck & DHH: 2. Test-induced design damage KB to DHH: TDD isnt taking you anywhere. Youre making the decisions.
  • 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: its a continuum and set of trade-offs
  • Martin Fowler, Kent Beck & DHH: 3. Feedback and QA As soon as you think youre not making mistakes, youre making mistakes. Kent Beck
  • Martin Fowler, Kent Beck & DHH: 4. Costs of Testing DHH: some tests are not justied KB: delta coverage MF: only test things that could possibly break DHH: insufcient energy in refactoring
  • 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
  • Martin Fowler, Kent Beck & DHH: 5. Summary KB: TDD is not dead but thanks for setting re to it DHH: TDD shouldnt be mandated but we dont want to lose self-testing code MF: if youre going to be involved in software development you have to be thoughtful
  • What do I think?
  • important to appreciate each others different experiences
  • I value TDD in some situations
  • I also value other forms of feedback
  • I sometimes write regression tests last
  • I think its always important to consider how valuable a test is
  • I know I still have a lot to learn
  • What do you think?
  • In summary
  • Learn from others
  • Consider the context
  • Think for yourself!
  • 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/
  • 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
  • Thanks for listening