← ClaudeAtlas

principle-testinglisted

Testing strategy and architecture — test pyramid (unit / integration / e2e), test doubles taxonomy (stub / mock / spy / fake), coverage-vs-confidence, mutation testing, flaky-test triage, contract testing, property-based and characterization tests, fixtures and test data builders. Distinct from principle-tdd which covers the red-green-refactor micro-cycle. Auto-load when discussing test strategy, mock vs real dependency, coverage adequacy, test pyramid balance, flaky test diagnosis, contract testing, or test architecture.
lugassawan/swe-workbench · ★ 2 · Testing & QA · score 68
Install: claude install-skill lugassawan/swe-workbench
# Testing Strategy and Architecture Strategy and architecture, not the red-green-refactor discipline. For that, see `principle-tdd`. ## The pyramid Three tiers, wide base up: **unit → integration → e2e**. Baseline ratio: ~70% unit, ~20% integration, ~10% e2e — adjust toward more integration for infrastructure-heavy systems, more e2e for UI-heavy products. Inverting the pyramid (heavy e2e, thin unit) produces a slow, brittle suite — e2e tests amplify flakiness and punish every external dependency. - **Unit** — one class or function, no I/O, milliseconds. - **Integration** — two or more collaborators, real infrastructure (DB, message bus), seconds. - **e2e** — full stack through the UI or API gateway; minutes. Prefer more granular tests. One integration test that exercises a migration is worth more than five e2e tests covering the same path. ## Test doubles Five kinds (Meszaros's xUnit Patterns taxonomy). State-based: Stub, Fake. Behavior-verification: Spy, Mock. Dummy is a degenerate no-op. | Double | What it does | When to use | |--------|-------------|-------------| | Dummy | Passed but never called | Satisfying required params | | Stub | Returns canned responses | Isolating the path under test | | Fake | Working implementation (e.g. in-memory DB) | Fast integration tests | | Spy | Records calls for post-hoc assertion | Verifying interactions | | Mock | Pre-programmed expectations; fails on violation | Strict boundary contracts | **Mock only at trust boundaries**: