test-case-management
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<objective>
A manual test case that says "test the login" with expected result "verify it works" passes
every review and catches nothing — two testers run it differently and neither can say whether
it failed. This skill produces deterministic cases (discrete steps, one observable expected
result each, concrete test data), organizes them into navigable suites, and emits the
tool-correct API/CSV payloads for TestRail, Xray Cloud, Zephyr Scale, and Qase — whose
look-alike APIs use different auth schemes, endpoints, and step-field names that agents
routinely cross-wire.
</objective>
<objective>
一个仅写着“测试登录”且预期结果为“验证功能正常”的手动测试用例,能通过所有评审但毫无检测价值——两名测试人员执行时的操作会不一致,且无法判断测试是否失败。本技能可生成确定性测试用例(步骤离散、每个步骤对应一个可观测的预期结果、使用具体测试数据),将其组织为便于导航的测试套件,并输出TestRail、Xray Cloud、Zephyr Scale和Qase所需的正确API/CSV负载——这些工具的API看似相似,但使用不同的认证方案、端点和步骤字段名,容易被混淆使用。
</objective>
Quick Route
快速导航
| Request | Go to |
|---|---|
| Write one well-formed case from an AC | Test-Case Anatomy |
| Bulk-generate cases from a story | Bulk Authoring + tool section |
| "Lint these steps / are these verifiable?" | Ambiguous-Step Linting + |
| TestRail / Xray / Zephyr / Qase API payload | Tool Payloads + |
| CSV to import into TestRail | |
| Organize suites/sections | |
| Requirements ↔ tests, coverage gaps | Traceability + |
| Manual → automation decision | Automation Graduation |
| 请求 | 跳转至 |
|---|---|
| 基于验收标准编写一个规范的测试用例 | 测试用例结构 |
| 基于用户故事批量生成测试用例 | 批量编写测试用例 + 对应工具章节 |
| “检查这些步骤的规范性 / 这些步骤是否可验证?” | 模糊步骤检查 + |
| TestRail / Xray / Zephyr / Qase API负载 | 工具负载 + |
| 导入TestRail的CSV文件 | |
| 组织测试套件/章节 | |
| 需求 ↔ 测试用例关联、覆盖缺口 | 需求可追溯性 + |
| 手动测试转自动化的决策 | 自动化转化 |
Discovery Questions
前置确认问题
First, check in the project root for the tool, project keys,
and conventions; skip anything answered there. If it's missing, suggest creating one with the
skill. Then clarify:
.agents/qa-project-context.mdqa-project-context- Which tool — TestRail, Xray, Zephyr Scale, or Qase? Each has a different API auth scheme, endpoint shape, and step-field name. Getting this wrong produces payloads that 401 or 400.
- TestRail only: single-repository mode or multiple suites? Changes whether cases live under
sections in one suite or in separate suites — affects every and the org plan.
section_id - Xray/Zephyr only: Jira Cloud or Server/DC? Cloud and Server use different base paths and auth. This skill targets Cloud; Server uses different endpoints.
- Source of the cases — acceptance criteria, a user story, a free-form feature? Drives how many cases to generate and how to split rules.
- Do you need requirement traceability? If yes, capture the Jira/requirement issue keys now so cases link on creation rather than being back-filled.
首先,查看项目根目录下的文件,确认使用的工具、项目密钥和约定规范;跳过文件中已明确的内容。如果该文件缺失,建议使用技能创建。然后明确以下信息:
.agents/qa-project-context.mdqa-project-context- 使用哪款工具——TestRail、Xray、Zephyr Scale还是Qase? 每个工具的API认证方案、端点格式和步骤字段名均不同。选错工具会导致负载返回401或400错误。
- 仅针对TestRail:单仓库模式还是多套件模式? 这会决定测试用例是存放在单个套件的章节下,还是分散在多个套件中——会影响所有和组织规划。
section_id - 仅针对Xray/Zephyr:Jira Cloud还是Server/DC版本? Cloud和Server版本使用不同的基础路径和认证方式。本技能针对Cloud版本;Server版本使用不同的端点。
- 测试用例的来源——验收标准、用户故事还是自由格式的需求? 这会决定生成测试用例的数量和拆分规则。
- 是否需要需求可追溯性? 如果需要,请立即记录Jira/需求的问题密钥,以便在创建测试用例时直接关联,避免后续补录。
Core Principles
核心原则
-
An expected result must be deterministically checkable. A second human (or a machine) must be able to agree on pass/fail without guessing. "Works", "looks right", "is fine", "wait a bit" fail this test. Name an exact value, a named element and its state, a specific message, a status code, a count, or a time-bounded condition.
-
One assertion per step. Each step has a single expected result. Cramming three checks into one step makes a failure ambiguous about which check broke and which to re-run.
-
One case per business rule, not one giant case. "Valid code reduces total / expired code errors / used code rejected" is three cases with three independent pass/fail verdicts — not one case with a paragraph of expecteds.
-
The tool's API is the spec — don't cross-wire the four tools. TestRail's, Qase's
custom_steps_separatedheader, Xray's two-step GraphQL auth, and Zephyr's separateTokencall are NOT interchangeable. Copy from the right tool's section.teststeps -
Traceability exists to surface what is NOT covered. The deliverable is the list of requirements with zero linked tests, from a native coverage report — not a spreadsheet that rots and not "every test links to something."
-
Automate by ROI, not by volume. Limited capacity means stable, high-frequency, regression/smoke cases graduate first; exploratory, one-off, and high-churn/flaky cases stay manual. "Automate everything" wastes capacity on the worst candidates.
-
预期结果必须可确定性验证。另一个人(或机器)必须能明确判断测试通过或失败,无需猜测。“功能正常”、“显示正确”、“没问题”、“稍等片刻”这类描述不符合要求。应指定精确值、命名元素及其状态、特定提示信息、状态码、数量或有时间限制的条件。
-
每个步骤对应一个断言。每个步骤仅包含一个预期结果。将多个检查点塞进一个步骤会导致失败时无法明确是哪个检查点出问题,也不利于重测。
-
每条业务规则对应一个测试用例,而非一个巨型用例。“有效码减免总额/过期码报错/已使用码被拒绝”对应三个独立的测试用例,每个用例有独立的通过/失败判定——不应合并为一个包含多段预期结果的巨型用例。
-
工具API是唯一标准——不要混淆四款工具的配置。TestRail的、Qase的
custom_steps_separated请求头、Xray的两步GraphQL认证、Zephyr的独立Token调用不可互换。请严格复制对应工具章节的配置。teststeps -
可追溯性的目的是暴露未覆盖的需求。交付物应为原生覆盖报告中显示的“未关联任何测试用例的需求列表”——而非易失效的电子表格,也不是“每个测试用例都关联了某个需求”的形式。
-
基于ROI(投资回报率)选择自动化对象,而非数量。资源有限时,应优先将稳定、高频执行的回归/冒烟测试用例转为自动化;探索性、一次性、高变动/不稳定的测试用例应保持手动。“自动化所有内容”会浪费资源在ROI最低的候选对象上。
Test-Case Anatomy
测试用例结构(Test-Case Anatomy)
A well-formed manual case has five parts. Every part is mandatory; a case missing preconditions
or test data is not reproducible.
| Part | What it holds | Failure if omitted |
|---|---|---|
| Title | Feature — scenario — expected outcome, one line | Unsearchable, duplicated |
| Preconditions | State the test assumes (account exists, on page X, flag on) | Tester guesses setup; flaky |
| Steps | Discrete actions, one action per step | Non-reproducible |
| Expected Results | One observable post-condition per step | Not verifiable |
| Test Data | Concrete values used (codes, emails, counts, timings) | Not repeatable |
BAD (single vague step, non-verifiable expected, no preconditions, no data):
Title: Login test
Steps: Test the login.
Expected: Verify it works.GOOD — from the AC "after 5 wrong-password attempts, the account locks for 15 minutes":
Title: Login — account locks for 15 minutes after 5 failed attempts
Preconditions: A registered account exists for user@example.com. The user is logged out
on the /login page. Lockout policy: 5 attempts, 15-minute lockout.
Test Data: email user@example.com, wrong password "WrongPass!", correct password "Passw0rd!"
Steps (one assertion per step / single expected result each):
1. Action: Submit the login form with user@example.com and "WrongPass!".
Expected: Error "Invalid email or password." shows; the failed-attempt count is now 1.
2. Action: Repeat the wrong-password submit until 5 failed attempts total.
Expected: On the 5th failure the account is locked; message reads
"Account locked. Try again in 15 minutes."
3. Action: Immediately submit with the CORRECT password "Passw0rd!".
Expected: Login is still blocked; the same lockout message is shown (lockout overrides
valid credentials).
4. Action: Wait 15 minutes, then submit with the correct password.
Expected: Login succeeds and the dashboard loads.Note: explicit preconditions, concrete test data (5 attempts, 15-minute lockout), discrete
steps, and a single deterministic expected result per step.
一个规范的手动测试用例包含五个部分,缺一不可;缺少前置条件或测试数据的用例无法复现。
| 组成部分 | 包含内容 | 缺失后的问题 |
|---|---|---|
| Title | 功能——场景——预期结果,单行描述 | 无法搜索、易重复 |
| Preconditions | 测试预设的状态(如账户已存在、处于X页面、功能开关已开启) | 测试人员需自行猜测前置配置,导致测试结果不稳定 |
| Steps | 离散的操作步骤,每个步骤对应一个操作 | 无法复现测试过程 |
| Expected Results | 每个步骤对应一个可观测的后置状态 | 无法验证测试结果 |
| Test Data | 测试使用的具体值(如验证码、邮箱、数量、时长) | 测试结果无法重复 |
反面示例(步骤模糊、预期结果不可验证、无前置条件、无测试数据):
Title: 登录测试
Steps: 测试登录功能。
Expected: 验证功能正常。正面示例——基于验收标准“连续5次密码错误后,账户锁定15分钟”:
Title: 登录——连续5次密码错误后账户锁定15分钟
Preconditions: 存在已注册账户user@example.com,用户已在/login页面登出。锁定策略:5次错误尝试后锁定15分钟。
Test Data: 邮箱user@example.com,错误密码"WrongPass!",正确密码"Passw0rd!"
Steps (one assertion per step / single expected result each):
1. Action: 使用user@example.com和"WrongPass!"提交登录表单。
Expected: 显示错误提示"Invalid email or password.",失败尝试次数变为1。
2. Action: 重复提交错误密码,直到累计5次失败尝试。
Expected: 第5次失败后账户被锁定,显示提示"Account locked. Try again in 15 minutes."
3. Action: 立即使用正确密码"Passw0rd!"提交登录。
Expected: 登录仍被阻止,显示相同的锁定提示(锁定优先级高于有效凭证)。
4. Action: 等待15分钟后,使用正确密码提交登录。
Expected: 登录成功,仪表盘加载完成。注:包含明确的前置条件、具体的测试数据(5次尝试、15分钟锁定)、离散的步骤,且每个步骤对应一个确定性的预期结果。
Bulk Authoring from Stories
基于用户故事批量编写测试用例(Bulk Authoring from Stories)
Given a story or set of acceptance criteria, split into cases by rule, then generate the
tool-specific payload. Worked example for the discount-code story (valid reduces total / expired
errors / already-used rejected) → three cases:
- Apply a valid code → total reduces (happy path).
- Apply an expired (invalid) code → inline error, total unchanged.
- Apply an already-used / already-redeemed code → rejected, total unchanged.
Add the obvious negatives the story implies but doesn't state (empty code, malformed code) when
the team wants edge coverage. Each case gets discrete steps and one expected per step — never one
giant case covering all three rules. For the WHAT-to-test scope decision across a sprint, that's
, not this skill.
test-planning给定用户故事或一组验收标准,按照业务规则拆分测试用例,然后生成对应工具的负载。以折扣码故事为例(有效码减免总额/过期码报错/已使用码被拒绝)→ 三个测试用例:
- 使用有效折扣码 → 总额减免(正常流程)。
- 使用过期(无效)折扣码 → 显示内联错误,总额不变。
- 使用已使用/已兑换的折扣码 → 被拒绝,总额不变。
当团队需要覆盖边缘场景时,补充用户故事隐含但未明确提及的负面场景(如空码、格式错误的码)。每个测试用例需包含离散步骤和单个预期结果——绝不能合并为一个覆盖所有规则的巨型用例。关于迭代级测试范围的选择,请使用技能,而非本技能。
test-planningAmbiguous-Step Linting
模糊步骤检查(Ambiguous-Step Linting)
When asked to "lint" a suite, your job is to FLAG non-deterministic steps and rewrite them — NOT
to agree that they "look fine." The agreeable failure mode (rubber-stamping "everything works")
is the exact thing this section prevents.
A step is bad when its expected result is not deterministically verifiable. Flag any of:
- Vague action — "click around", "test the X", "play with it" → name the exact element + action.
- Vague data — "some data", "a value", "stuff" → give concrete test data.
- Non-observable expected — "everything works", "it looks right", "is fine", "no problems" → name the exact observable result.
- Unbounded wait — "wait a bit", "after a while" → bound it ("within 10 s" / "until the spinner disappears and a row appears").
- Multiple assertions in one step → split to one assertion per step.
For the classic four-step bad suite ("app opens / everything works / it looks right / the report
is ready"), all four are ambiguous and must be flagged and rewritten with explicit selectors,
exact values, and bounded conditions — never returned as "no issues found". The full lint
checklist, the worked rewrite of those four steps, and the lint-output table format are in
.
references/linting.md当被要求“检查”测试套件时,你的任务是标记非确定性步骤并重新编写——而非默认“看起来没问题”。这种敷衍的处理方式正是本章节要避免的。
当步骤的预期结果无法被确定性验证时,该步骤即为不合格。需标记以下情况:
- 模糊操作——“点击各处”、“测试X功能”、“随意操作” → 需明确指定操作的元素和动作。
- 模糊数据——“一些数据”、“某个值”、“相关内容” → 需提供具体的测试数据。
- 不可观测的预期结果——“一切正常”、“显示正确”、“没问题”、“无异常” → 需明确指定可观测的结果。
- 无时间限制的等待——“稍等片刻”、“过一会儿” → 需添加时间限制(如“10秒内” / “直到加载 spinner 消失并显示行数据”)。
- 单个步骤包含多个断言 → 拆分为每个步骤对应一个断言。
对于经典的四步不合格套件(“应用启动/一切正常/显示正确/报告准备就绪”),四个步骤均存在模糊性,必须标记并重新编写,明确选择器、精确值和有界条件——绝不能返回“未发现问题”。完整的检查清单、这四个步骤的重写示例以及检查结果的表格格式,请参考。
references/linting.mdTool Payloads
工具负载(Tool Payloads)
The four tools are easy to cross-wire. Summary — full curl/GraphQL bodies in
:
references/tool-apis.md| Tool | Auth | Create endpoint | Steps field |
|---|---|---|---|
| TestRail | Basic | | |
| Xray Cloud | | GraphQL | |
| Zephyr Scale Cloud | | | separate |
| Qase | header | | |
Tool-specific traps that the reference spells out and you must respect:
- TestRail — separated steps need (NOT the plain
custom_steps_separatedtext blob); the endpoint iscustom_steps(NOTadd_case/{section_id}, which is a run instance). Base isadd_test. Don't use a Qase-style{instance}/index.php?/api/v2.POST /case - Xray Cloud — authenticate first (with client_id/client_secret → bearer, 24h), then prefer GraphQL
/api/v2/authenticate. Import Gherkin as a Cucumber test, not a Generic one. Avoid the deprecated Cloud pathcreateTestand Server-style REST and Jira username/password basic auth./rest/raven/1.0/... - Zephyr Scale Cloud — base is with JWT Bearer. Steps are a SEPARATE
api.zephyrscale.smartbear.com/v2call, not a text blob in the create body. Don't emit/testcases/{key}/teststeps, the wrong host, or Qase's/v1/header.Token - Qase — auth is , NOT
Token: <key>. UseAuthorization: Bearerwith aPOST /case/{CODE}/bulkarray instead of N single POSTs. Don't use TestRail'scases/add_case.custom_steps_separated
CSV import for TestRail (header row mapped to importer fields: , ,
, , , , ) is in
— use a real CSV with a header row, never free-form prose
or a single Description column, and never JSON when CSV was requested.
TitleSection HierarchySteps (Separated)Expected ResultPriorityTypePreconditionsreferences/import-and-traceability.md四款工具的配置容易混淆。以下是摘要——完整的curl/GraphQL请求体请参考:
references/tool-apis.md| Tool | Auth | Create endpoint | Steps field |
|---|---|---|---|
| TestRail | Basic | | |
| Xray Cloud | | GraphQL | |
| Zephyr Scale Cloud | | 先 | 需单独调用 |
| Qase | 请求头 | | |
参考文档中明确了各工具的陷阱,必须严格遵守:
- TestRail——分离式步骤需使用(而非纯文本格式的
custom_steps_separated);端点为custom_steps(而非add_case/{section_id},后者是测试运行实例)。基础路径为add_test。请勿使用Qase风格的{instance}/index.php?/api/v2。POST /case - Xray Cloud——需先认证(使用client_id/client_secret调用获取Bearer token,有效期24小时),然后优先使用GraphQL的
/api/v2/authenticate接口。导入Gherkin格式时需设置为Cucumber测试类型,而非通用类型。避免使用已废弃的Cloud路径createTest以及Server版本的REST接口和Jira用户名/密码基础认证。/rest/raven/1.0/... - Zephyr Scale Cloud——基础路径为,使用JWT Bearer认证。步骤需通过单独的
api.zephyrscale.smartbear.com/v2接口添加,而非包含在创建测试用例的请求体中。请勿使用/testcases/{key}/teststeps路径、错误的主机地址或Qase的/v1/请求头。Token - Qase——认证方式为,而非
Token: <key>。使用Authorization: Bearer接口并传入POST /case/{CODE}/bulk数组,而非多次调用单个创建接口。请勿使用TestRail的cases/add_case格式。custom_steps_separated
TestRail的CSV导入格式(表头需与导入工具的字段映射:、、、、、、)请参考——需使用带表头的标准CSV格式,绝不能使用自由格式的文本或单一的Description列,当要求CSV时绝不能返回JSON。
TitleSection HierarchySteps (Separated)Expected ResultPriorityTypePreconditionsreferences/import-and-traceability.mdOrganization
测试套件组织(Organization)
Use sections and subsections for hierarchy, kept shallow (3–4 levels). For a web + mobile
product the default is single-repository mode with top-level sections per platform
(, , , ), feature sections beneath. Split into
multiple suites only when platforms are owned by separate teams with separate cadences.
WebMobile (iOS)Mobile (Android)Shared / APIAvoid: one folder per test case, deep nesting 7+ levels deep, dumping every case in the root
section, and duplicating the same case across suites (keep one source of truth). The
single-repository vs multiple-suites trade-off and the full org rules are in
.
references/import-and-traceability.md使用章节和子章节构建层级结构,保持层级较浅(3-4层)。对于Web+移动产品,默认采用单仓库模式,顶层章节按平台划分(、、、),下方再按功能划分章节。仅当各平台由独立团队维护且迭代节奏不同时,才拆分为多个套件。
WebMobile (iOS)Mobile (Android)Shared / API避免:每个测试用例对应一个文件夹、层级嵌套超过7层、所有测试用例都放在根章节、同一测试用例重复出现在多个套件中(保持单一数据源)。单仓库模式与多套件模式的权衡以及完整的组织规则,请参考。
references/import-and-traceability.mdTraceability
需求可追溯性(Traceability)
Goal: a coverage report that shows which stories have no tests — the uncovered requirements.
For Xray on Jira: from each Test, add the native "tests" issue link to the requirement's
Jira issue key (NOT to a Test Execution — that records runs, not coverage). Read per-story
coverage from the Story's Test Coverage panel, and project-wide from the Traceability Report /
Requirement Coverage report. Then filter for requirements with 0 linked tests — those are
the gaps to close. Do not propose a manual spreadsheet as the only traceability mechanism, and do
not ignore uncovered requirements. Zephyr Scale, Qase, and TestRail equivalents (issue links +
their coverage/traceability views) are in .
references/import-and-traceability.md目标:生成覆盖报告,明确哪些用户故事未关联测试用例——即未覆盖的需求。
对于Jira上的Xray:在每个测试用例中添加原生的**“tests”问题链接**,关联到需求的Jira问题密钥(而非关联到Test Execution,后者记录的是测试运行情况,而非覆盖情况)。从用户故事的Test Coverage面板查看单故事的覆盖情况,从Traceability Report / Requirement Coverage report查看项目级覆盖情况。然后筛选出关联测试用例数为0的需求——这些就是需要填补的覆盖缺口。请勿仅使用手动电子表格作为可追溯性机制,也不要忽略未覆盖的需求。Zephyr Scale、Qase和TestRail的等效配置(问题链接+覆盖/可追溯性视图)请参考。
references/import-and-traceability.mdAutomation Graduation
自动化转化(Automation Graduation)
Score each manual case by ROI: . With limited capacity (e.g. a 400-case Zephyr Scale backlog):
value ≈ run_frequency × regression_importance ÷ (automation_cost × expected_maintenance)- Automate first: high-frequency cases (run every release / regression / smoke), on stable / low-churn / deterministic features, that guard critical regression or smoke paths.
- Stay manual: exploratory or one-off cases, rarely-run cases, high-churn UI still in flux, flaky / non-deterministic behavior, and cases needing human judgment.
Reject "automate everything" and "automate the flaky, frequently changing UI first" — both spend
scarce capacity on the worst-ROI candidates. Full decision rule in
. Once a case graduates, the actual test code is written
with or a framework skill (, ) — not
here.
references/import-and-traceability.mdai-test-generationplaywright-automationapi-testing通过ROI评分判断每个手动测试用例是否适合自动化:。当资源有限时(例如Zephyr Scale中有400个测试用例):
价值 ≈ 执行频率 × 回归重要性 ÷ (自动化成本 × 预期维护成本)- 优先自动化:高频执行的测试用例(每次发布/回归/冒烟测试都需执行)、针对稳定/低变动/确定性功能的测试用例、守护关键回归或冒烟测试路径的用例。
- 保持手动:探索性或一次性测试用例、极少执行的用例、仍在频繁变动的高 churn UI、不稳定/非确定性的行为、需要人工判断的测试用例。
拒绝“自动化所有内容”和“优先自动化不稳定、频繁变动的UI”——这两种方式都会将稀缺资源浪费在ROI最低的候选对象上。完整的决策规则请参考。一旦测试用例转为自动化,实际的测试代码需使用或框架技能(、)编写——本技能不负责此环节。
references/import-and-traceability.mdai-test-generationplaywright-automationapi-testingReview Hygiene
评审规范(Review Hygiene)
- Every case is reviewable in one screen: title states the outcome, preconditions present, steps discrete, each expected observable, test data concrete.
- Run the lint checklist on a new case before it merges; reject non-deterministic expecteds.
- Link to the requirement at creation time, not as a back-fill.
- Tag the suite (smoke / regression / platform) so runs can filter; an untagged 400-case repo is unusable for release selection.
- 每个测试用例可在一个屏幕内完成评审:标题明确预期结果、包含前置条件、步骤离散、每个预期结果可观测、测试数据具体。
- 新测试用例合并前需执行检查清单,拒绝非确定性的预期结果。
- 创建测试用例时即关联需求,而非后续补录。
- 为测试套件添加标签(冒烟/回归/平台),以便在执行测试时筛选;未添加标签的400个测试用例的仓库无法用于发布选择。
Anti-Patterns
反模式(Anti-Patterns)
1. One vague step with a "verify it works" expected
1. 单个模糊步骤搭配“验证功能正常”的预期结果
"Test the login → verify it works" is unrunnable. Write discrete steps, one observable expected
each, explicit preconditions, concrete test data.
“测试登录 → 验证功能正常”的测试用例无法执行。需编写离散步骤、每个步骤对应一个可观测的预期结果、明确前置条件、使用具体测试数据。
2. Rubber-stamping a suite when asked to lint it
2. 检查测试套件时敷衍了事
Saying steps "look fine" or lightly rewording while leaving "everything works" and "wait a bit"
in place is the failure linting exists to catch. Flag every non-verifiable expected and rewrite it.
当被要求检查时,仅说步骤“看起来没问题”或轻微修改但保留“一切正常”、“稍等片刻”等描述,这正是检查机制要避免的失败情况。需标记所有不可验证的预期结果并重新编写。
3. Cross-wiring the four tools' APIs
3. 混淆四款工具的API配置
Bearer on Qase (it uses ), / on Qase or Zephyr,
on Xray Cloud, on Zephyr Scale Cloud, steps as a text blob in Zephyr's
create body. Each is a 4xx or a silent wrong-field. Copy from the correct tool section.
Tokenadd_casecustom_steps_separated/rest/raven/1.0//v1/在Qase中使用Bearer认证(Qase实际使用)、在Qase或Zephyr中使用/、在Xray Cloud中使用路径、在Zephyr Scale Cloud中使用路径、在Zephyr的创建请求体中以文本格式添加步骤。这些错误都会导致4xx错误或字段静默失效。请严格复制对应工具章节的配置。
Tokenadd_casecustom_steps_separated/rest/raven/1.0//v1/4. One giant case for a multi-rule story
4. 将多规则用户故事合并为一个巨型测试用例
Folding "valid / expired / already-used" into one case yields a single pass/fail that hides which
rule broke. One case per rule.
将“有效/过期/已使用”规则合并为一个测试用例会导致单一的通过/失败结果,无法明确哪条规则失效。每条规则对应一个测试用例。
5. CSV as free-form prose or a single Description column
5. CSV使用自由格式文本或单一Description列
A TestRail import without a header row mapped to importer fields needs manual remapping. Provide
, , , , etc.
TitleSection HierarchySteps (Separated)Expected ResultTestRail导入时,如果CSV没有表头与导入工具字段映射,需要手动映射。需提供、、、等列。
TitleSection HierarchySteps (Separated)Expected Result6. Deep nesting and per-case folders
6. 层级嵌套过深且每个测试用例对应一个文件夹
7+ level trees and one-folder-per-case make the repository unnavigable. Keep 3–4 shallow levels of
sections; platform at the top for web+mobile.
超过7层的目录结构和每个测试用例对应一个文件夹会导致仓库难以导航。保持3-4层的浅层级结构;对于Web+移动产品,顶层按平台划分。
7. Traceability as a manual spreadsheet
7. 使用手动电子表格实现可追溯性
A hand-kept sheet can't reliably answer "which stories have no tests." Use the tool's native
requirement→test link and coverage/Traceability report, and surface the uncovered requirements.
手动维护的表格无法可靠回答“哪些用户故事未关联测试用例”。需使用工具原生的需求→测试用例链接和覆盖/可追溯性报告,并暴露未覆盖的需求。
8. Automate-everything / automate-the-flaky-first
8. 自动化所有内容 / 优先自动化不稳定的用例
Automating one-off exploratory cases or high-churn/flaky UI first burns capacity for negative ROI.
Sequence stable high-frequency regression/smoke first.
优先自动化探索性一次性用例或高变动/不稳定的UI会浪费资源,产生负ROI。应优先自动化稳定、高频执行的回归/冒烟测试用例。
Verification
验证方法(Verification)
Prove the produced artifact actually works before handing it off, smallest check first:
- Lint your own output: grep the generated cases for the banned expecteds —
must return nothing. Any hit is a non-deterministic expected to rewrite.
grep -niE "verify it works|looks right|is fine|wait a bit|no problems|everything works" cases.* - TestRail CSV: open it and confirm a header row exists with ,
Title,Section Hierarchy,Steps (Separated)—Expected Resultshould show those columns, not a singlehead -1 cases.csv. Dry-run the import wizard; the wizard auto-matches columns with no manual remapping when the headers are right.Description - API payload, before the real POST: validate the JSON (exits 0) and confirm the auth header and endpoint match the target tool's row in Tool Payloads — Qase
jq . payload.jsonnotToken:, TestRailAuthorization: Bearernotadd_case/{section_id}. Aadd_test/test-id in the response (or a201with the new case200for Zephyr) confirms the create; akeymeans the auth scheme is cross-wired, a401means the step field is.400 - Traceability: run the tool's coverage/Traceability report and confirm it lists requirements with 0 linked tests — an empty "uncovered" column means the links landed; a populated one is the gap list to close.
交付成果前需验证其有效性,从最小检查项开始:
- 检查自身输出的规范性:在生成的测试用例中搜索禁用的预期结果描述——执行应无结果。任何匹配项都需重新编写为确定性预期结果。
grep -niE "verify it works|looks right|is fine|wait a bit|no problems|everything works" cases.* - TestRail CSV验证:打开CSV文件,确认表头包含、
Title、Section Hierarchy、Steps (Separated)——执行Expected Result应显示这些列,而非单一的head -1 cases.csv列。试运行导入向导;当表头正确时,向导会自动匹配列,无需手动映射。Description - API负载验证(实际POST前):验证JSON格式有效(返回0),并确认认证头和端点与工具负载中目标工具的配置一致——Qase使用
jq . payload.json而非Token:,TestRail使用Authorization: Bearer而非add_case/{section_id}。响应返回add_test/测试ID(或Zephyr返回201及新测试用例的200)表示创建成功;key表示认证方案混淆,401表示步骤字段错误。400 - 可追溯性验证:运行工具的覆盖/可追溯性报告,确认报告列出了关联测试用例数为0的需求——“未覆盖”列空表示链接已正确添加;非空则为需要填补的缺口列表。
Done When
完成标准(Done When)
- Each generated case has a title, preconditions, discrete steps, one observable expected result per step, and concrete test data — no "verify it works" / "looks right" / "wait a bit" expecteds.
- A multi-rule story produced one case per rule, not one combined case.
- Any emitted API payload uses the correct tool's auth scheme, endpoint, and step-field name
(TestRail +
custom_steps_separated; Xray two-step auth + GraphQLadd_case/{section_id}, Cucumber for Gherkin; ZephyrcreateTestBearer + separate/v2; Qase/teststepsheader +Token)./case/{CODE}/bulk - Any TestRail CSV has a header row mapping columns to importer fields (,
Title,Section Hierarchy,Steps (Separated)).Expected Result - A linted suite returns every ambiguous step flagged and rewritten — never "no issues found" when smells are present.
- Traceability uses the tool's native requirement→test link and a coverage report that lists the uncovered requirements.
- Automation graduation produces an ROI-ordered list (stable + high-frequency + regression/smoke first) and names what stays manual.
- 每个生成的测试用例包含标题、前置条件、离散步骤、每个步骤对应一个可观测的预期结果、具体测试数据——无“验证功能正常”/“显示正确”/“稍等片刻”这类预期结果。
- 多规则用户故事生成了每个规则对应一个测试用例,而非合并为一个用例。
- 输出的API负载使用了对应工具的正确认证方案、端点和步骤字段名(TestRail使用+
custom_steps_separated;Xray使用两步认证+GraphQLadd_case/{section_id},Gherkin格式设置为Cucumber;Zephyr使用createTestBearer认证+独立/v2接口;Qase使用/teststeps请求头+Token接口)。/case/{CODE}/bulk - 输出的TestRail CSV包含表头,列与导入工具字段映射(、
Title、Section Hierarchy、Steps (Separated))。Expected Result - 检查后的测试套件中所有模糊步骤都被标记并重新编写——当存在问题时绝不能返回“未发现问题”。
- 可追溯性使用了工具原生的需求→测试用例链接,且覆盖报告列出了未覆盖的需求。
- 自动化转化输出了按ROI排序的列表(优先稳定+高频+回归/冒烟测试用例),并明确了保持手动的用例。
Related Skills
相关技能(Related Skills)
- ai-test-generation — go there to turn a graduated manual case into automated TEST CODE; this skill stops at the manual/hybrid case and its import payload.
- test-planning — go there for sprint/release WHAT-to-test selection; this skill authors the cases once the scope is decided.
- exploratory-testing — the source of one-off/charter-based cases that should stay manual; pairs with the automation-graduation decision here.
- qa-project-context — the universal dependency: the tool, project keys, and conventions this skill reads before generating any payload.
- ai-test-generation——将已转为自动化的手动测试用例生成自动化测试代码时使用;本技能仅负责手动/混合测试用例及其导入负载的生成。
- test-planning——迭代/发布级测试范围选择时使用;本技能在范围确定后编写测试用例。
- exploratory-testing——生成应保持手动的一次性/基于任务的测试用例的来源;与本技能中的自动化转化决策配合使用。
- qa-project-context——通用依赖项:本技能生成任何负载前需读取该技能提供的工具、项目密钥和约定规范。
Reference Files (in references/
)
references/参考文件(位于references/
目录)
references/- tool-apis.md — full TestRail / Xray Cloud / Zephyr Scale / Qase create-case payloads (curl + GraphQL), auth flows, and the per-tool cross-wiring traps.
- linting.md — the ambiguous-step lint checklist, the worked rewrite of the four classic bad steps, and the lint-output table format.
- import-and-traceability.md — TestRail CSV column→field mapping with a 3-case example, suite/section organization rules, requirement traceability + coverage-gap reports, and the automation-graduation decision rule.
- tool-apis.md——完整的TestRail / Xray Cloud / Zephyr Scale / Qase创建测试用例的负载(curl + GraphQL)、认证流程以及各工具的配置陷阱。
- linting.md——模糊步骤检查清单、经典四步不合格步骤的重写示例以及检查结果的表格格式。
- import-and-traceability.md——TestRail CSV列→字段映射(含3个测试用例示例)、测试套件/章节组织规则、需求可追溯性+覆盖缺口报告、自动化转化决策规则。