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

Lessons Learned from a Year of TDD and BDD

Ryan Castillo
September 14, 2012

Lessons Learned from a Year of TDD and BDD

Ryan Castillo

September 14, 2012
Tweet

More Decks by Ryan Castillo

Other Decks in Programming

Transcript

  1. Lessons Learned from a year of TDD and BDD Ryan

    Castillo - @rmcastil Friday, September 14, 12
  2. • Test Driven Development (TDD) - writing tests before writing

    the code being tested • Behavior Driven Development (BDD) - an evolution of TDD where the focus is on what an object does rather than what it is Jargon Friday, September 14, 12
  3. The Steps 1. Red 2. Green 3. Refactor 4. Repeat

    steps 1-3 Friday, September 14, 12
  4. Lesson 2: If you follow the steps correctly it will

    lead to ‘emergence’ in your code Friday, September 14, 12
  5. An Important Trick • Decrease the time between green •

    Set a constraint on how much time you should have between green tests • If you don’t meet the time constraint throw that code out (git checkout .) Friday, September 14, 12
  6. Lesson 3: the tests can heavily influence the design and

    vice versa Friday, September 14, 12
  7. Lesson 5: A binary test suite may be violating the

    DRY principal or you have heavy coupling somewhere Friday, September 14, 12
  8. Lesson 6: By default Rails tests are slow because they

    load Rails Friday, September 14, 12
  9. This allows you to think outside of Rails (or whatever

    framework) and back into Ruby Friday, September 14, 12
  10. Links and Resources • Michael Feathers on synergy between testing

    and design http://vimeo.com/15007792 • Corey Haines Fast Rails Tests http:// vimeo.com/30893836 • Corey Haines AR helper https:// gist.github.com/2068977 • Destroy All Software https:// www.destroyallsoftware.com Friday, September 14, 12