testarchitecture
Use when: structuring a test suite, separating unit from integration tests, or deciding what a test should and should not cross as a boundary.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when: structuring a test suite, separating unit from integration tests, or deciding what a test should and should not cross as a boundary.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when running workspace tests, choosing a test command, or summarizing results before handoff to debugger.
Use when running workspace tests, choosing a test command, or summarizing results before handoff to debugger.
Use when: running pre-commit or pre-push CI-equivalent checks in any workspace — discovers workflow commands with Cursor tools, filters for local executability, scopes to staged changes, and runs checks cheapest-first.
Use when the user wants to install or customize cursorAssistant in the current project (GitHub install or configure).
Use when: running pre-commit or pre-push CI-equivalent checks in any workspace — discovers workflow commands with Cursor tools, filters for local executability, scopes to staged changes, and runs checks cheapest-first.
Use when: discovering package manifests, assessing dependency health, finding replacements, or confirming import usage before removal — discovery only; mutating installs are handled by the deps agent.
| name | testArchitecture |
| description | Use when: structuring a test suite, separating unit from integration tests, or deciding what a test should and should not cross as a boundary. |
| type | reference |
| version | 1.0 |
| license | MIT |
Skill metadata: version "1.0"; tags [tdd, test-architecture, test-isolation]; recommended tools [].
A well-structured test suite is maintainable, fast to run, and clearly signals what broke and why. Poor test architecture creates slow, brittle, or duplicated suites that developers learn to distrust.
tddCycletestCoverage| Layer | Scope | Count | Speed |
|---|---|---|---|
| Unit | One function or class, all dependencies doubled | Many | Milliseconds |
| Integration | A group of real components together | Fewer | Seconds |
| End-to-end | Full system through public API or UI | Few | Tens of seconds |
The pyramid is a ratio, not an absolute count. A codebase with ten integration tests and one unit test is inverted. Add unit tests until the pyramid stabilizes.
Decide what the test's subject is, then double everything outside that boundary:
| Inside the boundary | Outside the boundary |
|---|---|
| The class or function under test | External services (HTTP, DB, filesystem) |
| Pure helper functions it calls | Clocks and random sources |
| In-memory data structures | Other modules if testing this module in isolation |
Test names are specification statements. They describe behavior, not implementation:
test_payment_is_rejected_when_card_is_expiredtest_payment_method_3Use the pattern: test_<subject>_<action>_when_<condition> or test_<subject>_<result>_given_<state>.
Write an integration test when:
Do not write integration tests as a substitute for missing unit tests.
Use these prefixes when reviewing test architecture:
isolation: — test crosses a boundary it should not (network, filesystem, shared state)pyramid: — test belongs at a different layer (too broad for a unit, too narrow for e2e)naming: — test name describes implementation rather than behaviorcoupling: — test depends on execution order or another test's statenit: — minor organization or style issue