Pragmatic Unit Testing in C++
summary
Argues unit testing only pays when paired with static and run‑time analysis as an “iron triangle,” and shows concrete steps to get ROI in legacy C++: move bodies out of headers, extract pure‑virtual interfaces, add link‑time or runtime seams, and use link‑time substitution or mock include for third‑party headers. Demonstrates tools that actually work: CGreen (process‑isolated tests, clear failures), MakitoPP (runtime mocks for pure‑virtual interfaces), callgrind/Valgrind, LTO/PGO. Notes ROI that erodes as teams grow (10 → 50 → 100+ devs) and gives examples that succeeded in reducing coupling and speeding debugging.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:47Summary
- 15:37What unit testing is not
- 27:52Optimize for readability
- 34:45Readability Example: cgreen
- 45:56Mocking: Runtime
- 47:45Mocking: Side-by-side
- 50:13Breaking Dependencies: Compile Time
- 52:30Move Body: Template functions
- 55:26Breaking Dependencies: Preprocessor
- 55:37Breaking Dependencies: Redefine symbols
- 56:23Breaking Dependencies: Link time
- 59:31Runtime Performance (cont'd)
related talks
59mC++ Unit testing - the good, the bad & the ugly
01h 01mAdvanced Unit Testing in C & C++
01h 01mBack to Basics: Debugging and Testing in C++ Software Development
38mProperties Of Unit Tests in C++
59mPragmatic unit testing
01h 01mBack to Basics: Unit Testing in C++
01h 03mBack to Basics: Testing in C++
53mC++ Unit testing - the good, the bad & the ugly
