让 AI 帮你把 PRD 变成高质量测试用例。按模块拆分,全程可追溯,专为高效交付的团队设计。
Transform PRDs into structured test cases with AI. Modular, traceable, and built for teams that ship.
不管是一个小功能还是一整套复杂系统,testspec 都能融入你的工作方式。
From small features to complex systems. testspec adapts to your workflow.
PRD 很大?没关系。可以逐个模块处理,也可以批量跑完,每个模块的进度都清清楚楚。
Large PRD? No problem. Process modules individually or in batches. Each module gets its own tracking and status.
只要跑过一次 testspec analyze,后面的命令就不用再带 -o 参数了——工具会自动记住你在做哪个功能。
Run testspec analyze once, then omit the -o flag. The tool remembers your context and picks up where you left off.
在 Cursor 里用斜杠命令,在 Qoder 里用结构化提示词,不用离开编辑器就能跑完整个流程。
Native slash commands for Cursor. Structured prompts for Qoder. Works where you work.
把团队的测试规范写进 constitution.md,之后不管谁来生成用例,格式、覆盖率、质量标准都一样。
Define your team's testing standards once. AI follows your rules for format, coverage, and quality on every generation.
一条命令看到所有模块的处理进度,哪些做完了、哪些还没开始,不用翻文件去找。
Visual module list shows exactly what's done and what's pending. No more guessing about test coverage.
一条命令导出 Excel,自带优先级颜色标注和筛选功能,拿到手就能用,直接导入测试管理工具。
One command exports all test cases to formatted Excel. Priority color-coding, auto-filter, ready for your test management tool.
四步走完,从需求到测试用例,每一步都可审查、可回溯。
A disciplined pipeline that turns requirements into verified test coverage.
testspec analyze -o <name>
读取 PRD 文档,自动拆解出可测试的功能模块,每个模块分配编号和英文名。
Parse the PRD and decompose into testable modules. Each module gets a numbered ID and English identifier.
testspec strategy [--module <id>]
为每个模块规划测试维度、评估优先级、预估要写多少条用例。
Define test dimensions, priorities, and estimated case counts for each module.
testspec generate [--module <id>]
按策略生成结构化的测试用例,统一编号格式 TC-{模块}-{序号}。
Produce structured test cases with numbered IDs. Format: TC-{module}-{sequence}.
testspec review [--module <id>]
对照 constitution 检查覆盖率,找出遗漏的场景和质量问题,给出具体补充建议。
Coverage audit against the constitution. Identify gaps, quality issues, and receive specific recommendations.
从装好工具到拿到第一份 Excel,跟着下面几步走就行。
From install to your first test case Excel, just follow these steps.
拉取代码,用开发模式装好,之后在任意位置都能用 testspec 命令。
Clone the repo and install in editable mode. The testspec command becomes globally available.
进入你的项目目录,运行 init 命令。会自动生成 .testspec/ 配置目录和 IDE 集成文件。
Run init in your project root to generate the .testspec/ directory (including constitution.md and config.yaml) plus IDE integration files.
准备好 PRD 文档,按顺序跑四个阶段就行。每一步都会输出 Markdown 中间文件,你可以看完再决定要不要继续。
With your PRD ready, run through the four stages. Each stage produces intermediate Markdown files for human review before proceeding.
最后一步,一条命令就能把所有用例导出成带格式的 Excel,交给团队直接用。
One command exports all cases to a formatted Excel with priority color-coding and auto-filters, ready for your team.
拿一个优惠券系统的 PRD 当例子,看看每个阶段跑出来是什么样的。
Using a coupon system PRD as an example, see the actual output from each stage.
| 用例编号 | Case ID | 模块 | Module | 用例标题 | Title | 优先级 | Priority | 类型 | Type | 前置条件 | Precondition | 测试步骤 | Steps | 期望结果 | Expected |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TC-002-001 | 002-coupon-claim | 有效优惠券正常领取 | Valid coupon normal claim | P0 | 功能 | Functional | 用户已登录,活动进行中 | User logged in, campaign active | 1. 进入领取页 2. 点击领取 | 1. Go to claim page 2. Click claim | 领取成功,库存-1 | Claim succeeds, inventory-1 | |||
| TC-002-002 | 002-coupon-claim | 达到领取上限 | Claim limit reached | P0 | 边界 | Boundary | 已领取 N 张 (N=上限) | Claimed N coupons (N=limit) | 1. 再次点击领取 | 1. Click claim again | 提示"已达上限" | Show "limit reached" | |||
| TC-003-001 | 003-coupon-use | 满减券正常使用 | Threshold coupon normal use | P0 | 功能 | Functional | 持有满100减20券,订单>100 | Has $100-$20 coupon, order>$100 | 1. 下单 2. 选择优惠券 | 1. Place order 2. Select coupon | 订单金额减20 | Order total reduced by $20 | |||
| TC-003-002 | 003-coupon-use | 订单未满足满减门槛 | Order below threshold | P1 | 边界 | Boundary | 持有满100减20券,订单=99 | Has $100-$20 coupon, order=$99 | 1. 尝试使用优惠券 | 1. Try to apply coupon | 提示"未满足使用条件" | Show "conditions not met" | |||
| TC-004-001 | 004-coupon-expire | 到期自动失效 | Auto-expire on due date | P1 | 功能 | Functional | 持有即将到期的优惠券 | Has coupon about to expire | 1. 等待过期 2. 查看状态 | 1. Wait for expiry 2. Check status | 状态变为"已过期" | Status changes to "Expired" |
在 constitution.md 里写好你们团队的测试规范,AI 每次生成都会照着做。
Define your team's testing standards in constitution.md. AI enforces them on every generation.
写清楚编号怎么排、哪些字段必填、文案怎么写。不管谁来跑,输出都是一样的格式。
Define case ID rules, required fields, and writing style. Consistent output regardless of who runs testspec.
设好覆盖率底线。正向、反向、边界、异常都得有,review 阶段还会再查一遍有没有漏的。
Set minimum coverage requirements. AI must cover positive, negative, boundary, and exception dimensions. Review stage auto-checks for gaps.
不允许写"正确显示"这种模糊描述,每条用例都要能直接拿去执行,减少返工。
No vague descriptions or placeholder data. Every case must be "directly executable", reducing manual rework.
这个文件跟着代码一起做版本管理。团队的测试经验不断沉淀,新人来了也能输出高质量用例。
Constitution lives in version control. Team testing knowledge accumulates over time. New members produce high-quality cases from day one.
Cursor 用斜杠命令、Qoder 用结构化提示词,不需要切到终端。
Native slash commands for Cursor and structured prompts for Qoder. No context switching.
testspec init 就行。如果之前已经有一些测试用例了,可以丢到 .testspec/memory/ 目录里,AI 生成新用例时会参考这些历史数据,避免重复。
Works perfectly with existing projects. Just run testspec init in your project root. You can place existing test cases in the .testspec/memory/ directory as reference. AI will consider this historical data when generating new cases, avoiding duplicates and maintaining consistency.