~/talk

Unit Testing: Prefer Children Over Friends

Talkat CppCon 2019 · 2019-09-15..09-20· [testing]
links:none on file
slides:none on file

Advocates replacing test-only friend access with small subclasses that expose just what tests need, using a concrete example: a PlayerStats object that should start at maximum health and zero currency. Notes testing frameworks CxxTest and Catch, warns that friends effectively make privates public, and recommends refactoring into separate Health and Currency classes with public interfaces or using approval tests and legacy-code/TDD practices to get safe, testable units.

AI-written summary · about

  1. 0:00Intro
  2. 0:28About Michael
  3. 0:45Children and Friends
  4. 0:59Player Stats
  5. 1:34Avoid Making Members Public
  6. 2:31Legacy Testing
  7. 2:44Using Children
  8. 3:19Refactoring
  9. 4:24What I learned
~/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.