Clean Test Code
summary
Argues that poorly written tests can be worse than no tests and recommends refactoring legacy code before adding tests. Advocates focused, parameterized unit tests with a Given-When-Then structure (one When only), using parameter arrays for multiple cases, and avoiding brittle UI assertions by using data-selectors and harnesses. Shows practical examples: using a Pact mock server for real HTTP calls against a stubbed provider and a command-handler test asserting three side effects (persist, change context, emit event), and warns that aiming for an arbitrary 80% coverage target is a dangerous anti-pattern.
AI-written summary · about
chapters (8)
- 0:00Wprowadzenie do tematu
- 1:07Problemy z kodem testowym
- 8:51Anatomia czystego testu
- 14:30Testowanie warstw aplikacji
- 20:55Testy stanu i akceptacyjne
- 23:01Praktyczne wzorce testowe
- 31:16Testowanie modułów i abstrakcji
- 35:30Podsumowanie i wnioski
related talks
41mTesting that the code does what the code does
20mThe Art of Testing
57mAdvanced Testing Techniques: Tips from the trenches
01h 24mPragmatic Not Dogmatic
59mPragmatic unit testing
44mTesting the untestable - patterns and use cases analysis
39mTen things you heard about testing that might be wrong
01h 05mMicrotesting
