with one click
testing
测试方法(语言无关)——TDD、测试金字塔、Mock 原则、覆盖率哲学、反模式。具体测试工具(Vitest / pytest)见所用预设。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
测试方法(语言无关)——TDD、测试金字塔、Mock 原则、覆盖率哲学、反模式。具体测试工具(Vitest / pytest)见所用预设。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Execute the check workflow from this AI development team preset. Use when the user writes /check, asks for check, or wants the corresponding team process in Codex.
Execute the dev workflow from this AI development team preset. Use when the user writes /dev, asks for dev, or wants the corresponding team process in Codex.
Execute the fix workflow from this AI development team preset. Use when the user writes /fix, asks for fix, or wants the corresponding team process in Codex.
Execute the plan workflow from this AI development team preset. Use when the user writes /plan, asks for plan, or wants the corresponding team process in Codex.
Execute the project-preset workflow from this AI development team preset. Use when the user writes /project-preset, asks for project-preset, or wants the corresponding team process in Codex.
Execute the review-all workflow from this AI development team preset. Use when the user writes /review-all, asks for review-all, or wants the corresponding team process in Codex.
| name | testing |
| description | 测试方法(语言无关)——TDD、测试金字塔、Mock 原则、覆盖率哲学、反模式。具体测试工具(Vitest / pytest)见所用预设。 |
这是通用方法,不绑定测试框架。具体工具与可运行示例见所用预设:
- web-fullstack:
.agents/rules/testing.md+.agents/specs/testing.md(Vitest / Playwright)- ai-app:
lang/python/specs/python.md(pytest)/lang/typescript/specs/typescript.md(Vitest)
每个循环 2-10 分钟。不写没有失败测试的生产代码。
Arrange(准备数据/依赖)
Act (执行被测行为)
Assert (断言结果)
命名:描述功能 > 应该在[条件]时[行为](中文/英文均可,全项目统一)。
| 层级 | 范围 | 速度 | 依赖 | 比例 |
|---|---|---|---|---|
| 单元 | 单函数/类 | 最快 | 无(全 mock/fake) | ~70% |
| 集成 | 模块边界 | 中 | 真实 DB/FS | ~20% |
| E2E | 完整用户流 | 慢 | 全栈 | ~10% |
底层多、顶层少。E2E 贵且脆,只覆盖核心流程。
空值 / null / undefined、空集合、零值/负值/最大值、权限不足、并发竞态、外部依赖失败。
| 类型 | 何时用 | 工具见预设 |
|---|---|---|
| 集成测试(真实依赖) | 验证 DB/外部交互 | Testcontainers / pytest fixtures |
| 契约测试 | 服务间接口约定 | Pact 等 |
| 属性测试 | 输入空间大、有不变量 | fast-check / hypothesis |
| 快照测试 | UI/序列化输出 | 框架自带(review 时仔细看 diff) |