Unit Test Craftsmanship
summary
Shows how a messy invoicing unit test with buried setup and ten-plus asserts gets refactored into a few clear lines that read like behavior: invoice line-item DSL, create anonymous fixtures for irrelevant data, and assert on a single expected object. Uses xUnit-style frameworks, IDE extract-method refactorings, and TDD for the small custom assertions that are themselves testable. Demonstrates duplicating-product and multi-product cases and cuts repetitive tests from ~20 lines to about five.
AI-written summary · about
chapters (16)
- 0:00Start
- 1:15What Does it Take To be Successful?
- 5:21Economics of Maintainability
- 9:18Use Better Assertion
- 12:18Hard-Coded Test Data
- 13:25Creation Method
- 14:11Remove Irrelevant Information
- 15:31Introduce Custom Assertion
- 16:50Four-Phase Test
- 20:29Improving Terminology
- 21:55Test Coverage
- 24:06Rapid Test Writing
- 27:29Removing Deodorant
- 27:49Benefits
- 30:09Reducing the Need to Refactor Tests
- 32:49Closing Thoughts








