Tests should explain failures
Test-failure rules cover assertion shape and failure output that help humans and agents diagnose the failing case quickly.
Assertions and test failures that guide repair.
3 rules
Avoid opaque boolean assertionsPrefer comparisons or richer assertions when a predicate hides state needed to diagnose the failure. The first failure should show the useful actual value.Optimize failure outputDesign tests so failures include expected values, actual values, inputs, and contract context where that helps repair. Useful output shortens CI and agent debugging loops.Split unrelated assertionsSplit assertions that diagnose different behaviors when one failure would hide another. Keep checks together only when they express one contract more clearly as a group.