More tips on TDD

Four major parts of a test:

  1. Setup state: Arrange - Setup state (fixture) (Given...)
  2. Run application code: Act - Run application code (exercise System-Under-Test) (When...)
  3. Check expectations: Assert - Check if it worked (Then...)
  4. Cleanup state: Teardown

Different types of tests:

  • Stubs - check how data flows in a program
  • Mocks - use to avoid testing every combination of dependencies
  • Characterization - test after development (TAD) - take a snapshot of the current program
views