~/talk

Properties Of Unit Tests in C++

Talkat C++ on Sea 2024 · 2024-07-02..07-05· [testing, c-and-cpp]
github:arnemertz
slides:none on file

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

  1. 0:00Unit tests in C++ intro
  2. 3:21Unit vs integration tests
  3. 5:06Unit test purposes
  4. 9:21Unit test properties
  5. 10:47Correctness and maintainability
  6. 13:03Graybox testing edge cases
  7. 15:11Code coverage goals
  8. 16:22Strong domain types
  9. 17:50Readability and documentation in tests
  10. 21:49Test usability
  11. 22:59Test case ordering
  12. 24:50Test directory structure
  13. 25:53Speed and feedback
  14. 28:23Infrastructure vs domain
  15. 30:11Simplicity and avoiding over-engineering
  16. 31:16Test independence
  17. 33:30Determinism and globals
  18. 35:38Dependency injection
  19. 37:24Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.