The Big TDD Misunderstanding
6 days ago
- #tdd
- #unit-testing
- #software-architecture
- The term 'unit' in 'unit test' originally referred to the test itself, not a unit of the system under test.
- There are two schools of thought in testing: mockist vs. classicist.
- Writing tests from a realistic user perspective (outside-in) improves quality assurance and refactor resistance.
- Avoid isolating code during testing to prevent fragile tests; only isolate from truly external services.
- Never change code without a failing (red) test to ensure proper TDD practices.
- TDD does not inherently drive software architecture; non-functional requirements (NFRs) define architecture.
- The trade-off in automated testing involves balancing quality assurance, refactor resistance, and feedback speed.
- Using real databases and avoiding excessive stubbing can make tests more meaningful and reliable.
- Test coverage reports are more useful when tests reflect realistic usage rather than isolated units.
- Consider alternatives to the traditional testing pyramid, such as 'Honeycomb' or 'The Testing Trophy'.