Five Factor Testing by Sarah Mei

This was an excellent read; we spend a fair bit of time wondering what to test and relatively little on why we’re testing. This post changed how I think about testing. https://madeintandem.com/blog/five-factor-testing/

Key points – Sarah describes five reasons for writing automated tests:

  1. Verify the code is working correctly
  2. Prevent future regressions
  3. Document the code’s behaviour
  4. Provide design guidance
  5. Support refactoring

All pretty unexceptionable; but the bit that was new to me was, those things aren’t mutually compatible, and there are always tradeoffs – tests that thoroughly document the functionality at a low level can make it much harder to refactor or add new functionality, for example, and the right mix of tests depends on your individual situation – how important to you and your project is each of the five factors?