Saturday, March 17, 2012

Test value is in running them

Have you seen a build flag that states "no tests". What's the point building code without running all your tests? What's the harm in running them one last time? Tests are there to be run. A LOT! Settings that allow you to run tests every time you save a file in your IDE help ensure your unit tests are fast and passing all the time. Unit tests are there to catch you when you break something unexpected. You may think your fixing a bug with a date-time object but maybe that fix breaks something else down the line. The tests are there to tell you. If you never run your tests then why bother having them? Why not just delete them all?

When should tests be run?

  • As often as possible. Especially fast unit tests
  • Every time you build
  • Before committing changes to production code to version control
  • Before  committing changes to test code to version control
  • After committing code to version control (via Continuous Integration)