awesome-everything RU
↑ Back to the climb

Engineering Practice

TDD: multiple-choice review

Crux Multiple-choice synthesis across the TDD unit — design pressure, the boundary rule for doubles, property shapes, the spec-stability tradeoff, and mutation score as the honest metric.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 13 min

Six questions that cut across the whole unit. Each one is a decision a senior makes under real constraints — a fragile suite, an unknown vendor, a green CI sitting on a 67% mutation score — not a definition to recite.

Goal

Confirm you can connect the unit’s spine: test-first as design pressure, the boundary rule that tames doubles, properties over examples, when TDD’s tax is worth paying, and mutation score as the metric coverage can’t fake.

Quiz

You write a test first and find you must construct four collaborators — DB, payment, email, flags — just to exercise one cancel-order rule. What is the test actually telling you?

Quiz

A PriceCalculator uses a pure TaxRule you own and a third-party CurrencyApi over HTTP. How should you double each for a robust unit test?

Quiz

A money formatter has 94% coverage and eight months of green CI, then double-charges a customer on a value ending in .005. Why did every example test miss it, and what would have caught it?

Quiz

A senior insists on full TDD for a two-day spike to evaluate an unfamiliar vendor API and decide whether to sign. Why is this the wrong call?

Quiz

A billing module shows 100% line coverage but a 67% mutation score, with a surviving '>' → '>=' boundary mutant. How do you read this?

Quiz

Across the unit, what is the through-line that distinguishes a test suite that is an asset from one that is a liability?

Recap

The unit’s spine is one judgment loop. Test-first is design pressure — a hard-to-construct object is the design review, not an obstacle to mock around. The boundary rule tames doubles: mock what you can’t run, use real objects for code you own, assert state. Example tests cover only inputs you imagined, so properties generate the rest and shrink failures to a minimal counterexample. TDD’s tax (15–22%) pays off in proportion to spec stability and code lifetime — spike the unknown, then rebuild. And mutation score is the honest metric: coverage proves a line ran, a survived mutant proves a test would have missed the bug. Through all of it, couple to behavior, never to structure.

Continue the climb ↑TDD: free-recall review
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.