test-strategy-architect
Architect-level test strategy — allocating assertions across unit, integration, contract and end-to-end layers, designing for testability through dependency boundaries, fixture and data strategy, and the flake and coverage policies that keep a suite trustworthy. Use when defining how a codebase is tested.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- test-strategy-architect
- license
- MIT
- metadata
- { "crusor-path": "website-architect/testing-and-deployment-architect/test-strategy-architect", "crusor-domain": "website-architect", "crusor-origin": "original", "crusor-sources": "martinfowler.com/articles/practical-test-pyramid.html; testing.googleblog.com (test sizes); xunitpatterns.com", "crusor-triggers": "test strategy, test plan, test pyramid, testing pyramid, test suite, flaky, test coverage, e2e strategy, integration tests, contract tests, testability, fixtures", "crusor-verified-on": "2026-10-30" }
- description
- Architect-level test strategy — allocating assertions across unit, integration, contract and end-to-end layers, designing for testability through dependency boundaries, fixture and data strategy, and the flake and coverage policies that keep a suite trustworthy. Use when defining how a codebase is tested.
- compatibility
- Any language; any test runner
03 SKILL.md 正文
Test Strategy Architect
A test suite is a decision about where failures should be caught. Everything else — mocks, fixtures, coverage — follows from that decision.
When to use
- Starting a codebase, or a suite is slow, flaky or ignored.
- Deciding where a new behaviour should be tested.
- Coverage is being used as a target instead of a signal.
When NOT to use
- Framework-specific mechanics (see
vitest-,react-testing-,playwright-architect).
Decision 1 — Allocate by cost of failure
| Question | Layer |
|---|---|
| is this rule correct? | unit |
| does this talk to the database/queue correctly? | integration |
| did the contract change? | contract (consumer-driven) |
| can a user complete the journey? | e2e |
| is it fast / accessible / secure enough? | non-functional gate |
- One behaviour, one layer. Duplicating a rule at three layers buys nothing and costs three times the maintenance.
- The cheapest layer that can catch the bug owns the test.
Decision 2 — Testability is architecture
- Pure functions for rules; side effects at the edges — that is what makes unit tests fast.
- Depend on interfaces you own (repository, clock, HTTP client), injected not imported — no mocking of your own modules.
- Time, randomness and IDs are injectable; otherwise tests become non-deterministic and get deleted.
- If a behaviour is hard to test, the coupling is the bug.
Decision 3 — Test data
| Approach | Use |
|---|---|
| builder/factory functions | default; explicit per-test data |
| shared fixtures | read-only reference data only |
| database transactions/rollback | integration tests |
| seeded snapshots | never for mutable state |
| production-like anonymised dump | rare, large-scale perf work |
- Each test creates the state it needs and leaves nothing behind.
- No test depends on another test's side effects or ordering.
- IDs/timestamps generated per run, never hard-coded dates in the future.
Decision 4 — Non-functional gates
- Performance: a budget test on critical paths (p95, bundle size).
- Accessibility: automated scan plus a manual checklist per release.
- Security: dependency audit, SAST, and an authorization matrix test.
- These run in CI like any other gate; "we'll check before launch" means never.
Decision 5 — Trust policies
- Flake policy: any test failing intermittently twice is fixed, quarantined or deleted — decided within a sprint, never tagged and forgotten.
- Coverage: track per-module trend in critical paths; a global percentage gate invites useless tests.
- Test names describe behaviour and the failure mode, not the function.
- Delete tests that no longer protect anything; a suite is code and carries maintenance cost.
Failure modes at scale
- 3,000 mocked unit tests, zero integration tests, production surprises weekly.
- A shared fixture mutated by tests, producing order-dependent failures.
- Coverage gate at 85% satisfied by snapshot tests asserting nothing.
- E2E used to verify validation rules already covered by unit tests.
- Nobody runs the suite locally because it takes 20 minutes.
Verification receipts
- Portfolio table: tests per layer, runtime per layer.
- Failure drill: introduce a real bug — which layer catches it, and how fast?
- Flake report over the last 50 CI runs with actions taken.
- Testability review: no mocking of in-repo modules; clock/randomness injected.
- Critical-path coverage trend, not a single percentage.
04 同仓库更多 Skills
interaction-patterns-architect
Architect-level interaction design in code — choosing established patterns over invented ones, feedback and latency behaviour, destructive-action safeguards, navigation and overlay conventions, and the state model behind every interactive surface. Use when a screen has to behave, not just look.
design-system-ops-architect
Architect-level operation of a design system in code — token pipelines and versioning, component API and variant policy, the catalogue as the contract, adoption metrics, and the governance that stops a system from forking into three. Use when a component library must survive several teams.
design-handoff-architect
Architect-level design handoff — what must be specified before implementation starts, tokens over raw values, responsive and content-limit contracts, state matrices, and the review loop that catches drift between design and code. Use when a design is about to become code.
content-microcopy-architect
Architect-level UI content — where strings live, voice and terminology consistency, error and empty-state copy as part of the interface, translation-ready authoring, and the content model a product needs before it multiplies screens. Use when the words in the interface matter as much as the pixels.
ui-ux-implementation-architect
Architect-level direction for turning a design into working UI — the handoff contract, component ownership versus screen-level layout, interaction and state conventions, design QA gates, and the review habits that keep an implementation faithful without frozen pixels. Use before any specific UI implementation skill.
release-strategy-architect
Architect-level release practice — small-batch delivery, feature flag and canary strategy, expand/contract database changes, rollback versus roll-forward decisions, and the versioning and communication that keep releases boring. Use when deciding how code reaches users.