Fallacies of Unit Testing
summary
Argues that unit tests become brittle, implementation‑aware and inflate design by adding interfaces and mocks, and that many projects get poor ROI from them. Builds an ASP.NET Core API with LocationProvider, SolarCalculator and a Redis cache, exercises the full HTTP pipeline with WebApplicationFactory and Redis in Docker via xUnit fixtures, injects a startup filter to fake client IPs, and replaces fragile unit assertions with functional tests that run in memory, are deterministic and finish with single‑second latencies.
AI-written summary · about
chapters (25)
- 0:00Introduction to talk
- 1:49Clarifying unit testing definitions
- 5:57What is a unit in unit testing
- 7:23Isolation and mocking in unit tests
- 9:11Purpose of unit testing
- 10:15Example of non-unit-testable code
- 11:58Design impact of unit testing
- 13:23Drawbacks of unit testing
- 15:29Unit tests rely on implementation details
- 17:35Unit tests complicate design
- 18:17Unit tests are expensive
- 20:04Limited purpose of unit tests
- 21:07User value and testing layers
- 23:15Practical test pyramid assumptions
- 25:44Fallacies of the test pyramid
- 29:35Reality-driven testing approach
- 32:44Functional requirements and tests
- 36:15Guidelines for better testing
- 37:36Functional test example setup
- 40:00Integration testing with ASP.NET Core
- 41:45Using Docker for test dependencies
- 43:12Writing functional end-to-end tests
- 45:15Injecting test data for assertions
- 47:43Balancing integration scope and cost
- 48:28Summary and key takeaways
related talks
01h 02mTesting First - Getting The How
54m.NET Testing Best Practices
39mTen things you heard about testing that might be wrong
47mThe secret unit testing tools no one ever told you about
52mBuilding Operable Software with TDD (but not the way you think)
43m.NET Testing Best Practices
15mWhy TDD Is Crap
52mxUnit Expanded – Better Testing With xUnit
