← ClaudeAtlas

unit-testing-rubriclisted

Standards for writing, reviewing, and evaluating unit tests. Use whenever writing new tests, reviewing existing tests, deciding what to test, assigning a test to a fast vs. full feedback loop, or diagnosing flaky, slow, or low-value tests. Covers structural fidelity, the FIRST properties, behavioral invariants, and coverage-as-diagnostic.
Accelerated-Innovation/governed-ai-delivery · ★ 20 · Testing & QA · score 62
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