test-architecture-strategy
Design a sustainable test architecture using test desiderata, test pyramid tradeoffs, fast and slow test separation, integration boundaries, CI feedback loops, and architecture choices that make code testable. Use when a test suite is too slow, too brittle, too mock-heavy, unclear about unit vs integration coverage, or needs a testing strategy before major growth.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- test-architecture-strategy
- license
- MIT
- metadata
- { "tags": "tdd,testing,architecture,ci,test-pyramid", "version": "0.1.0", "category": "Testing", "displayName": "Test Architecture Strategy" }
- description
- Design a sustainable test architecture using test desiderata, test pyramid tradeoffs, fast and slow test separation, integration boundaries, CI feedback loops, and architecture choices that make code testable. Use when a test suite is too slow, too brittle, too mock-heavy, unclear about unit vs integration coverage, or needs a testing strategy before major growth.
- compatibility
- Codex, Claude Code, and other Agent Skills-compatible clients.
02 资源文件 3
- 参考文档agents/openai.yaml224 B
- 参考文档evals/evals.json870 B
- 参考文档references/test-architecture-patterns.md2.5 KB
03 SKILL.md 正文
Test Architecture Strategy
Use this skill to reason about the shape of a test suite, not one test at a time. The goal is a suite that gives confidence, runs quickly enough for flow, and still catches integration failures at important boundaries.
Source Traceability
Primary source: Harry Percival, Test-Driven Development with Python, 3rd ed. Guidance is transformed and paraphrased from chapter 27 and Appendix A, especially test desiderata, fast/slow test tradeoffs, test pyramid thinking, boundaries, ports and adapters, functional core/imperative shell, and when to rethink architecture.
Workflow
-
Inventory the current suite.
- Identify unit, integration, functional/end-to-end, smoke, and manual checks.
- Capture runtime, flake rate, CI split, and developer feedback path.
-
Classify the pain.
- Slow feedback.
- Brittle structure-coupled tests.
- Mock-heavy tests with low confidence.
- Missing boundary coverage.
- Too many end-to-end tests.
-
Choose the target shape.
- Fast tests for core logic and detailed cases.
- Integration tests at real boundaries.
- A small number of end-to-end tests for critical journeys.
- Production monitoring or smoke checks where tests are not enough.
-
Move one slice at a time.
- Extract pure logic or service boundaries.
- Replace exhaustive end-to-end coverage with lower-level tests plus one journey.
- Add contract or integration checks for external systems.
- Define a runtime red line before the suite becomes painful.
Read test-architecture-patterns.md for audit questions, migration patterns, and decision tables.
Decision Rules
- If tests are slow but valuable, first separate fast local feedback from full CI proof.
- If unit tests require databases or frameworks everywhere, identify pure core logic that can move inward.
- If mocks dominate, use architecture seams rather than more mocks.
- If end-to-end tests cover many detailed branches, demote detailed cases to lower-level tests.
- If integration bugs keep escaping, add boundary tests before deleting broad coverage.
Guardrails
- Do not chase a textbook test pyramid without respecting the product's real risks.
- Do not delete slow tests until replacement confidence exists.
- Do not make every piece of code "pure" at the cost of framework clarity.
- Do not optimize runtime without measuring.
Verification
Before finishing, produce:
- Current suite map.
- Pain classification with evidence.
- Target suite shape.
- First migration slice.
- Verification commands or metrics that prove progress.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.