- Write the failing test first, then implement the minimum code to pass, then refactor — never skip the red-green-refactor cycle.
- Run the full test suite after each refactor step to ensure nothing broke — tests are your safety net for aggressive refactoring.
- Keep tests fast (under 1 second each) — slow tests break the TDD feedback loop and discourage frequent test runs.
- Use the Arrange-Act-Assert pattern: set up data, perform the action, verify the result.
- Isolate the unit under test by replacing collaborators with fakes or stubs so each test validates one behavior.
- Maintain test coverage above 80% for business logic — focus on complex and risky code.