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

testing revisited - outside-in

Matt Yoho
June 21, 2012
99

testing revisited - outside-in

Matt Yoho

June 21, 2012
Tweet

Transcript

  1. 2) Write enough code to make it pass Make it

    green Thursday, June 21, 12
  2. 2) Write enough unit tests and code to pass the

    acceptance test Thursday, June 21, 12
  3. Sometimes, we want to isolate the item under test from

    another dependency Thursday, June 21, 12
  4. A dependency is any external piece of code the item

    under test relies on or collaborates with Thursday, June 21, 12
  5. When a dependency is expensive or difficult to use, it

    may be a good idea to swap it out for a test double Thursday, June 21, 12
  6. stub: a “dumb” stand-in for a real object that responds

    to messages (methods), sometimes returning canned responses Thursday, June 21, 12
  7. Used when we want to isolate the code under test

    from uncertainty or costly execution Thursday, June 21, 12
  8. mock: a stand-in for a real object that expects to

    receive messages (methods) and provides testing verification Thursday, June 21, 12
  9. Used when we want to test (verify) that the code

    under test collaborates properly with its depedencies Thursday, June 21, 12
  10. They will think they’re doing it right. Or at least,

    doing it less wrong than they are. Thursday, June 21, 12
  11. Testing is a religion - especially TDD/BDD People will evangelize.

    And they’re wrong. Thursday, June 21, 12
  12. Exercise: Add show/hide item to simple_feed Add a link on

    items the user owns to hide them, or to show them for hidden items. Thursday, June 21, 12