High-level principles for testing

  • A test should ideally be self-sufficient and self-contained.

  • Test code should be obvious rather than DRY.

  • The interactive workflow shouldn’t leak into and undermine the test suite.

Writing good tests for a code base often feels more challenging than writing the code in the first place.