Properties Of Unit Tests in C++
summary
Argues unit tests must be tiny and fast — aim for milliseconds per test so thousands run in minutes; expect roughly 10:1 test:prod code and design tests to be independent, repeatable and deterministic. Prefer graybox testing: exercise the public interface while using implementation knowledge to hit edge cases. Pull slow I/O and threads into integration tests, inject clocks and dependencies for determinism, keep one assertion per focused test, and favor readable, collocated tests.
AI-written summary · about
chapters (19)
- 0:00Unit tests in C++ intro
- 3:21Unit vs integration tests
- 5:06Unit test purposes
- 9:21Unit test properties
- 10:47Correctness and maintainability
- 13:03Graybox testing edge cases
- 15:11Code coverage goals
- 16:22Strong domain types
- 17:50Readability and documentation in tests
- 21:49Test usability
- 22:59Test case ordering
- 24:50Test directory structure
- 25:53Speed and feedback
- 28:23Infrastructure vs domain
- 30:11Simplicity and avoiding over-engineering
- 31:16Test independence
- 33:30Determinism and globals
- 35:38Dependency injection
- 37:24Summary
related talks
01h 07mProperties of Unit Tests
01h 03mProperties of Unit Tests
01h 01mBack to Basics: Unit Testing in C++
01h 07mPragmatic Unit Testing in C++
01h 03mBack to Basics: Testing in C++
21mTest Kitchen: A Recipe for Good Tests
48mEffective Unit Testing
46mTesting the untestable - patterns and use cases analysis
