unit-testing-rubriclisted
Install: claude install-skill Accelerated-Innovation/governed-ai-delivery
# Unit Testing Rubric
## Purpose
Create a trustworthy, deterministic, affordable test suite that protects
behavioral invariants, supports refactoring, and provides rapid feedback.
Flaky tests are defects in the feedback system and must be fixed, replaced, or
removed.
## Testing Integrity
**1. Fidelity Rule** — Tests must be structurally honest. The production
behavior under test must execute the same way in the test harness as in
production. Introduce seams around dependencies, not around behavior.
*Would production execute the same behavior if this test did not exist?*
**2. Documentation Rule** — A microtest is executable documentation. A developer
should understand the behavior, context, action, expected result, and important
edge cases without reading the implementation.
*Can a developer understand the behavior from the test alone?*
**3. Single Action Rule** — An Arrange–Act–Assert test performs exactly one
action in one context. Multiple assertions are acceptable when they examine
evidence from the same action.
*What is the single action being performed?*
## FIRST Properties
**4. Fast Rule** — Tests should support rapid feedback. The fast suite (however
the project invokes it) should complete in well under a minute; treat ~30
seconds as a reasonable default budget absent a project-specific one.
*Is this test worth spending part of the fast-feedback budget?*
**5. Isolation Rule** — Tests must not depend on execution order, shared mutable
state, hidden fixtures, o