• The two anti-patterns - unit tests only without integration tests and integration tests with no unit testing - both come from problematic assumptions about the time required, the complexity of integration tests, the difficulty of setting up the test environment. Unit tests are faster to set up, run and write fixes for, and can recreate outlier scenarios more easily; but some issues are only visible in integration.
  • Avoid testing for the wrong functionality or a less relevant one by building a mental model of the product or service as critical functions, core functions and everything else. Focus on critical functions, and code that breaks or changes often.
  • Tying tests tightly to the code itself is an anti-pattern. Don’t focus on tests verifying internal implementation, focus on testing functionality of features instead.
  • Not converting production bugs into tests is a mistake. It is not enough to simply fix the bug that passed through but test for it so that future releases will be safeguarded.
  • Do not write tests without reading all the documentation for your testing framework. Most frameworks will suffice for most jobs and you should not need to write much (or any) custom code or reinvent the wheel where standard code and best practices exist.

Full post here, 41 mins read