Friday, July 26, 2019

How to avoid writing unit tests


  1. Use the type system -- compile errors are better than test failures
  2. Use libraries instead of writing your own code (and having to test it yourself as well).
  3. Say no to unnecessary features. Be ruthless. Every new feature means more testing.
  4. Test all the glue with a single integration test. Testing glue with unit tests is a waste of time:
    1. glue unit tests only ever fail when you're refactoring, so they are all maintenance and no protection
    2. they are not useful as documentation (there's no point documenting glue)
    3. This does NOT apply to unit tests for business logic (as opposed to glue)
  5. Write simpler code.

No comments: