TDD - The Last Word

Friday, September 27, 2013

It can cost 500% less to fix a bug before checking into source control

TDD is part of the agile development philosophy

Red - Green - Refactor!

Benefits:

  1. Higher quality - fewer defects
  2. Living Documentation
  3. Well crafted Code
  4. Automatic Regression Harness
  5. Each test is a specification of how the software behaves under a particular condition
  6. Unit testing is less expensive than Integration Tests, System Tests and Functional Tests
  7. Confidence that adding new features to the system doesn't break any functionality

Example of calling code and an api with no tests to test the functionality


The API


A unit test confirms functionality of a small unit of functionality or component in a larger system


Unit Test


Implementation


New Test



Implementation Refactored


Refactor out repeated logic into helper methods. DRY.


Unit Test



Implementation

Default Success Warning Important Info Inverse
B S W I ? O