Quickly Testing Legacy C++ Code with Approval Tests
summary
Shows how to lock down legacy behavior fast using ApprovalTests.cpp: a header-only C++11 library that plugs into Google Test, Catch and doctest, generates received/approved files (it always fails first run), and launches GUI diff tools (Araxis/Beyond Compare) via uses differencing reporters. Demonstrates verify/verifyAll and verifyAll combinations up to nine for Cartesian-product input testing, custom writers/comparators for images, regex “scrubbers” to normalize dates, placing approved files in VCS, and CI-friendly workflows. Useful if you need quick golden-master coverage before refactoring.
AI-written summary · about
chapters (30)
- 0:00Introduction
- 1:35Clares background
- 2:37Backstory
- 6:33What is Legacy
- 8:58Locking down the current behavior
- 9:49Golden Master Testing
- 11:35Thoughts on Golden Master
- 12:26Approval Tests
- 14:10Starter Project
- 15:20Download Single Header File
- 16:02Code Examples
- 21:33Approval Tests vs Test Framework
- 22:59Approval subdirectory
- 23:51Questions
- 29:22Documentation
- 31:06Legacy Code
- 32:46Legacy Thing
- 33:17Consistency
- 34:38Writing Tests
- 37:33Formatting
- 42:40No Discard
- 43:47Convention Over Configuration
- 44:17Stable Outputs
- 45:36Common Challenges
- 46:11Example
- 47:18Encapsulation
- 48:46Approval Test Example
- 50:37Differencing Tools
- 50:50Summary
- 51:21Thank you
related talks
45mAdd Tests to Legacy Code with Approval Tests
57mQuickly Testing Qt Desktop Applications with Approval Tests
01h 44mTUTORIAL: Refactoring without a net
01h 01mBack to Basics: Debugging and Testing in C++ Software Development
49mWorking with C++ Legacy Code
59mC++ Unit testing - the good, the bad & the ugly
01h 40mTesting, Preconditions, Coverage and Templates in Safety-Critical C++ Code
45mTest Automation Without Assertions
