§ 87
Beyoncé Rule
In a shared codebase, the behavior no test checks is the behavior that changes without warning.
Keep in mind
If you depend on it, put a test on it
What to do
Write a test for every behavior your product relies on in a shared library or dependency, and make sure it runs in the CI that gates other people's changes. When something breaks and no test caught it, add that test before closing the incident. If you own the shared code, say up front that tests are the contract, and do not invoke the rule unless your changes actually run consumers' tests.
Why it happens
A team changing infrastructure that the whole codebase uses cannot read every caller, so the only contract it can check at scale is the test suite. Whatever the suite does not exercise is invisible to them and changes without warning, not through carelessness but because nothing told them it mattered. The rule turns that blind spot into an assignment of responsibility: if an unrelated change passes all your tests and still breaks your product, the fix and the missing test are yours. It is only fair where a pervasive CI system runs everyone's tests against everyone's changes.
When it stops applying
Churn Rule: a test-shaped contract tells the changer what it broke, not that breaking it was free; the team making the change still owes its users the migration.
Source
Adam Bender, "Testing Overview", in Winters, Manshreck & Wright, Software Engineering at Google (O'Reilly, 2020), ch. 11 — "If you liked it, then you shoulda put a test on it", invoked by infrastructure teams making changes across the entire codebase.
Read the sourceCite this
Read in a column
Related laws
- 08Hyrum's LawWith enough users, every observable behavior of a system, bugs included, is depended on.
- 88Churn RuleWhen the team that changes shared infrastructure can push the migration onto its users, the cost of the change multiplies by the number of users.
- 95Pesticide ParadoxEvery way of finding bugs leaves behind the bugs it cannot find, so a test suite that never changes finds fewer and fewer.
- 97One-Version RuleWhen consumers may choose which version of a shared dependency to use, each choice becomes a conflict for someone who never made it.
- 105Test Oracle ProblemA test can only catch a wrong answer if something independent of the code knows the right one, and for many programs nothing does.