Optimize Failure Output

TEST-OPTIMIZE-FAILURE-OUTPUT

Summary

Design tests so failures include expected values, actual values, inputs, and contract context where that helps repair. Useful output shortens CI and agent debugging loops.

Rule

Optimize tests for useful failure output.

Why

A passing test is useful, but a failing test is where maintainers and agents spend repair time. Tests should fail with the expected and actual values, relevant input, and enough context to identify the broken contract without rerunning under a debugger.

Helps

  • Shortens repair loops and makes regression failures actionable in CI logs.

Limits

Do not turn tests into verbose diagnostics when the failure is already obvious. Add output where it changes the speed or reliability of repair.

Agent Instruction

Optimize tests for useful failure output because a passing test is useful, but a failing test is where
maintainers and agents spend repair time.

Mechanisms

Supported by whole-value comparisons, snapshots, named table cases, custom messages with input context, and regression tests that preserve useful failure shape.

References