Add Tests to Legacy Code with Approval Tests
summary
Shows how Approval Tests turns untestable legacy code into verifiable outputs by dumping program state to human-readable files, opening a diff tool, and accepting the correct result as an approved file. Demonstrates creating a seam (replace System.out with a logger, inject Random) to make runs deterministic, adding characterization tests to lock behavior before refactoring, and even image and HTML diffs. Java support is current, Maven publishing is pending, and approved files live in source control for CI.
AI-written summary · about
chapters (11)
- 0:00Start
- 3:39Approval Tests
- 4:37Demo
- 14:21Add Tests for Embedded Numbers
- 18:39Characterization Tests
- 21:28Legacy Code Maintenance Techniques
- 29:29Code Coverage
- 33:11Verify User Interface
- 35:55Limitations
- 37:48The Seven Deadly Sins of Software Development
- 42:46Type Based Assertions
related talks
01h 02mQuickly Testing Legacy C++ Code with Approval Tests
01h 44mTUTORIAL: Refactoring without a net
47mTelling Better Stories with Tests
43mFrom 0% to Cleanly Refactored 100% tested code
54mTesting in Legacy: From Rags to Riches
01h 01mYou Can Test Anything
42mTest-Driven Repair
36mFrom Sledgehammer to Fine Brush for QA
