Testing
PreviewTests that can fail, written before the fix is trusted.
A test that passes both before and after a change proves nothing. Builder writes the failing test first and keeps it as the evidence that the fix works.
Bug-fix protocol#
- 1Reproduce the reported behaviour in a test. The test must fail on the current code.
- 2Record the failure output as evidence in the trace.
- 3Apply the minimal change.
- 4Re-run: the new test passes and the existing suite stays green.
- 5Report both runs side by side.
Test quality rules#
- Assert behaviour, not implementation detail. A test coupled to internals breaks on every refactor.
- Prefer one clear failure reason per test over a single test with twelve assertions.
- Cover the boundary and the error path, not only the success path.
- Do not mock the thing under test. Mocking the subject produces a test of the mock.
- Keep tests deterministic: no real clocks, no real network, no ordering dependence.
Last updated 2026-09-01

