Learning objectives
After this chapter you should be able to:
- Distinguish fault, error and failure, and apply the test levels, the pyramid, coverage and mutation score.
- Explain why coverage measures execution rather than adequacy, and compute a mutation score.
- State testing's load-bearing assumption, show how an agent-written test can encode the defect it should catch, and explain why different authorship alone does not establish independence.
- Design structural independence: acceptance tests derived from the specification, written first, and read-only to the implementing agent.
- Compute pass@k and pass^k from trial counts, choose between them for a given component, and set a release threshold with a stated confidence.
- State what evidence would overturn the verdict.
Opening case
A composite case, not a real engagement.
The dispatch dashboard from Chapter 6 reaches review with a strong-looking report: 214 tests, all passing, 93% line coverage, a green CI badge. This is how one defect got past all of that.
The chapter continues from here.
What the chapter covers
- 13.1 The classical method
- 13.1.1 Fault, error, failure
- 13.1.2 Levels, the pyramid, and oracles
- 13.1.3 Coverage is not adequacy
- 13.1.4 Mutation testing
- 13.1.5 What the classical method got right
- 13.2 The assumption it depends on
- 13.3 What agents change
- 13.3.1 One author, one blind spot
- 13.3.2 Tests that change until they pass
- 13.3.3 Tests as steering
- 13.3.4 Nondeterministic components and evals
- 13.3.5 LLM-as-judge
- 13.3.6 Property-based testing
- 13.4 The verdict
- 13.5 What replaces it: structural independence
- 13.5.1 Four rules
- 13.5.2 Tests as steering: red, green, and a human
- 13.5.3 Designing an evaluation for a component that calls a model
- 13.5.4 Dispatch, twice
- 13.5.5 What the replacement keeps
- 13.6 Lab: Do your tests mean anything?
- 13.7 What would make this verdict false
Lab and prediction
Lab: Do your tests mean anything?
Feeds milestone M5. How the labs fit the project
This chapter's own prediction: Agent-written suites have lower mutation scores than spec-derived acceptance suites, and at least one agent-written test fails once a specification-contradicting behavior is corrected.
A result that contradicts a prediction, honestly reported, is a result. You are graded on accurate records and reasoned interpretation, not on agreeing with the book.
Summary
- Coverage measures execution, not adequacy; mutation score measures whether a suite has teeth.
- Load-bearing assumption: tests are written with intent independent of the defect. When one agent writes both, a test can encode the bug and a pipeline can stay green while meaning nothing. Different authorship alone does not establish independence (Knight and Leveson 1986).
- Evidence: LLM-generated oracles mainly capture actual behavior, models have tampered with graders they could reach, and output varies even at temperature 0.
- Verdict: recalibrate. The structure holds; independence must be enforced, and "pass" becomes a rate for model-calling components.
- Replacement: acceptance tests derived from the specification, written first, read-only to the implementer, checked by mutation testing, with a held-out subset, used to steer the agent through red and green.
- Evals: pass@k for exploration, pass^k for must-work paths, inputs from the operational profile, and trials sized to the confidence you need.
Key terms
- Fault, error, failure
- a flaw in code or design; the incorrect internal state it causes; the visible departure from required behavior.Also used in 4, 8, 15, 17
- Test oracle
- the mechanism that decides whether observed behavior is correct.
- Coverage
- the share of code a suite executes; not a measure of adequacy.Also used in 1, 2, 4, 5, 12, 14, 15
- Mutant, equivalent mutant
- a copy of the program with one small change; one that behaves identically and cannot be killed.
- Mutation score
- mutants killed divided by mutants generated minus equivalent mutants.Also used in 2, 18
- Test independence
- the expected value in a test does not derive from the code under test. Different authorship alone does not establish it.Also used in 12
- Read-only acceptance test
- a spec-derived test the implementing agent cannot modify, enforced by permissions and CI.
- Defect-encoding test
- a test whose expected value contradicts the specification.
- Eval
- a test suite for a nondeterministic component: inputs, a scoring rule, repeated trials, a rate.Also used in 14
- pass@k, pass^k
- the probability that at least one, or all, of k trials succeed; pass^k equals pᵏ when trials are independent (Yao et al. 2024; Chapter 15).
- LLM-as-judge
- using a model to grade another model's output; subject to position, verbosity and self-preference biases.
Connections
Where this chapter and another point to each other most often.
- Chapter 2: The Assumption Audit: A Method That Outlasts the Tools
All four judge assertion quality; none asks where the expected value came from, so a test that encodes the bug can satisfy all four. ## 13.4 The verdict Recalibrate. Chapter 2's decision rule (Section 2.5) first asks whether the assumption still describes agent-assisted work. - Chapter 4: Requirements as the Primary Artifact
The grace period is requirement D3 (Chapter 4). - Chapter 6: Cost and Schedule Estimation After COCOMO
State what evidence would overturn the verdict. ## Opening case A composite case, not a real team. The dispatch dashboard from Chapter 6 reaches review with a strong-looking report: 214 tests, all passing, 93% line coverage, a green CI badge. - Chapter 11: Construction When Code Is Cheap
Specify the evidence you would need for each claim. 10. "With tests as steering, the person who writes the acceptance tests has become the programmer." Argue for or against, with reference to Chapter 11. 11. - Chapter 12: Reviews: Inspecting Evidence, Not Diffs
A person reviews the evidence, not the agent's report that it passed (Chapter 12). - Chapter 14: Configuration Management When Agents Commit
Make them read-only to the implementing agent, and enforce it.** Put acceptance tests in a protected path the implementing agent cannot write, add a CI check that fails any change touching it unless a named human approved, and run the acceptance suite from the protected branch's copy (Chapter 14). - Chapter 15: Reliability of Nondeterministic Systems
It equals pᵏ only when the trials are independent (Chapter 15). - Chapter 16: Roles and the Four Conditions for Assurance
Each is separation or diversity, a candidate for independence whose value is measured by what it catches that the code's own tests miss (Chapter 16, condition 1), not assumed. - Chapter 18: Running the Whole Life Cycle: The Engineer as Manager of an Agent Team
From Chapter 18: Eight activities fill the manager's week: specify (Chapter 4), decompose (Chapters 7 and 11), assign (Chapters 8 and 16), review evidence packages (Chapter 12), verify (Chapters 13 and 15), decide (Chapters 7 and 14), escalate (Chapters 16 and 17) and record.
Further reading
- Inozemtseva and Holmes (2014). The largest study of coverage and effectiveness; read its threats to validity.
- DeMillo, Lipton, and Sayward (1978). The origin of mutation testing, in a few pages.
- Chen et al. (2021), Section 2.1. Where pass@k and its unbiased estimator are defined.
- Yao et al. (2024). The definition and use of pass^k; read how fast reliability falls as k grows.
- Barr et al. (2015). A survey of the oracle problem, this chapter's theme in general form.