Unit Testing by Example
summary
Concrete how-to and measurable wins: start by writing a failing test for a discovered bug (example: make quantity 0.1 round up to 1), add tests when changing behavior (example: free shipping when subtotal ≥ 40 pounds), write tests before new features (catalog import parseFromCSV) and use integration checks as API contracts. Uses PHPUnit + Guzzle + ghazal, measures cyclomatic branches via PHPUnit reports, claims roughly a 50% speedup (six weeks → three) and shows tests actually prevent regressions.
AI-written summary · about
chapters (25)
- 0:00Introduction
- 2:05How to become a testing expert
- 3:40Testing without automation
- 7:00First opportunity to test
- 9:50Safety net
- 13:25Regression test
- 13:52Improving existing code
- 14:42Changing the code
- 14:59Test both cases
- 15:33New code
- 17:50inspect array
- 18:57rock climbing
- 20:15ecommerce example
- 21:33catalog imports example
- 22:46write less code
- 24:45some things to consider
- 27:22use your judgment
- 29:05how many test cases
- 29:33cyclomatic complexity
- 29:58execution paths
- 31:09decision branches
- 38:08recap
- 39:57testing as preemptive debugging
- 51:00mock dependencies
- 52:47handling mocks
related talks
46mUnit Testing by Example
29mEffective tests and testing effectively
01h 00mPrinciples of Unit Testing
52mWriting Unit Tests Using PHPUnit
45mTesting Legacy Code - What To Do When It Seems Untestable
35mThe Absolute Beginner's Guide To Test-Driven Development
49mTesting for the Brave and True
01h 05mMicrotesting
