Writing tests before code clarifies requirements to be implemented. Tests are programs rather than data, so:

  • can be executed automatically
  • test includes a check that is has executed correctly
  • usually relies on a testing framework

Though programmers usually prefer programming to testing:

  • they may take shortcuts when writing tests
  • some test are difficult to write
  • difficulty judging completeness of a set of tests without full spec