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

Brian Swan - TDD Pitfalls

Lean Agile Scotland
October 26, 2012
660

Brian Swan - TDD Pitfalls

Test Driven Development is now more than 10 years old yet is still causing controversy as a development technique. Common pitfalls can reduce the value of Test Driven Development, this talk will highlight those pitfalls to help teams and individuals get the maximum benefit from this powerful technique.

Lean Agile Scotland

October 26, 2012
Tweet

More Decks by Lean Agile Scotland

Transcript

  1. Kent Beck, Test Driven Development By Example Write a failing

    automated test before you write any code. Remove duplication.
  2. Kent Beck, Test Driven Development By Example Write a failing

    automated test before you write any code. Remove duplication. production ^
  3. what I’m going to cut out is the stuff that’s

    not absolutely critical. And unit tests are not critical. If there’s no unit tests the customer isn’t going to complain about that. Jamie Zawinski, Coders At Work p34
  4. As for Joel’s consistent dismissal of unit testing, he’s just

    wrong about that. Unit testing (done TDD style) does not slow you down, it speeds you up. Bob Martin, http://blog.objectmentor.com/articles/2009/09/24/the-duct-tape- programmer
  5. 1.Taxi – get in position. 2.Takeoff – apply power in

    one general direction until airborne. 3.Climb – manage steep growth at full power. 4.Cruise – make steady progress towards clear goals. Kent Beck, http://www.threeriversinstitute.org/blog/?p=251
  6. Practices like developer testing that were useful in moderation in

    the takeoff phase and became a matter of survival in the climb phase now help increase profitability by reducing cost. Kent Beck, http://www.threeriversinstitute.org/blog/?p=251
  7. RSpec Minitest test-unit Riot Bacon Wrong Shindo testrocket rubydoctest Testy

    Micronaut Lemon test_inline dtf Detest kintama Cucumber Steak Turnip Spinach Coulda Stella Unencumbered Stories Filet saki rspec-mocks Mocha Rr Flexmock Stump Facon Cross-stub simple_mock Factory Girl Machinist Fabrication FixtureBuilder Object daddy dm-sweatshop Blueprints Fixjour spawn FixtureReplacement sham Transactionata Faker Forgery ffaker Randexp Random data Capybara Webrat capybara-webkit Culerity Celerity Selenium-client Akephalos watir-webdriver poltergeist headless Selenium-on-rails Watir Polonium Guard Watchr Autotest Kicker Infinity Test tconsole tork
  8. Don’t split up you tests into slow and fast, split

    up you app into other apps or libs. Splitting the tests is just ignoring the problem plus people will just stop looking at the slow test. Daniel Worthington-Bodart, http://dan.bodar.com/2012/02/28/crazy- fast-build-times-or-when-10-seconds-starts-to-make-you-nervous/
  9. The trouble with non-deterministic tests is that when they go

    red, you have no idea whether its due to a bug, or just part of the non-deterministic behavior. Martin Fowler: http://martinfowler.com/articles/nonDeterminism.html
  10. I get paid for code that works, not for tests,

    so my philosophy is to test as little as possible to reach a given level of confidence... Kent Beck, http://stackoverflow.com/questions/153234/how-deep-are- your-unit-tests
  11. ...Ten or twenty years from now we'll likely have a

    more universal theory of which tests to write, which tests not to write, and how to tell the difference. In the meantime, experimentation seems in order. Kent Beck, http://stackoverflow.com/questions/153234/how-deep-are- your-unit-tests