mcpField
C
cawplan-testrail-link

cawplan-testrail-link

github.com/cawcut测试与质量177 次安装2 天前更新
代码仓库

关于 cawplan-testrail-link

用于在 CawPlan 与 TestRail 之间关联已导入用例、测试计划或运行记录的 Skill。它区分两套流程,并要求先预览、检查冲突,再经确认执行。

主要功能

  1. 01用例与测试点关联
  2. 02计划和运行记录绑定工单
  3. 03执行前预览
  4. 04冲突与里程碑门禁
  5. 05自动处理套件和分区

适用场景

  1. 01将 CSV 导入用例引用关联到 TestRail 用例
  2. 02把 TestRail 计划或运行记录绑定到工单
  3. 03执行关联前检查映射与冲突

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/cawcut/skill-cawplan --skill cawplan-testrail-link

安装后在 Claude Code 中输入/cawplan-testrail-link确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
link-cases.md
link-plans.md
ux.md

详细介绍

来自项目 README

CawPlan TestRail Link — T2-A8 手工映射回链

cawplan skill check

硬门禁(MUST)

  1. preview-first → 确认闸 → execute --confirm;禁止跳闸。
  2. Workflow B 前置:milestone mapping-get → has_mapping=false 必须停止(固定文案见 link-plans.md §MilestoneGate);不得继续 preview/execute。
  3. Workflow A 冲突:conflicts 非空 → 禁止 execute;须先人工处理 TestRail/CawPlan 侧冲突。
  4. 禁止:直连 TestRail API;调用 import/execute 或 plan/execute 冒充 link;无 preview 的 execute。
  5. 用户展示:ux.md §Glossary;preview_id/mapping_id/UUID 默认隐藏;Case / Plan / Run / Suite ID 必须可点击(ux.md §TestRailLinks)。
  6. 热接力 + AutoScan(Workflow A):P1 可跳过 A1;suites.length===1 无感采用 Suite;Section 走 link-cases.md §AutoScan(无 parent preview → 无感 retry 1 次 → 仍失败才框 A3s)。禁止每轮框 3.5「新建顶级 / 缩小」。
  7. Cost:按 ux.md §Cost 懒加载 reference、缓存 mappings get、preview 表截断展示;禁止为消歧重复全量 sections list(AutoScan retry 时允许按 suite 缓存调一次)。

Reference 加载(MUST · 降本)

时机Read禁止
路由 / 框 0 / 确认闸 / Preview·Result 模板 / 错误ux.md 对应 §一次性 Read 全部 references
仅 Workflow Alink-cases.md 对应 §未路由到 A 时 Read
仅 Workflow Blink-plans.md 对应 §未路由到 B 时 Read

Prompt 路由(框 0)

命中Workflow
用例 / Case / CSV / refs / 导入后回链 / link caseA
Plan / Run / 测试计划 / 工单绑定 / link planB
A 与 B 同时命中AskUserQuestion 二选一(ux.md §Prompts 框 0)
均未命中框 0:链接 用例 还是 计划/运行?

路由后 只走一条 Workflow;禁止同轮混跑 A+B。

允许命令

用途命令
映射 / originqa-insights testrail mappings get <product_id>
Section 查找(A · AutoScan / 框 A3s)qa-insights testrail sections list <product_id> <suite_id> [--refresh]
Milestone 闸门(B · Step 1)qa-insights testrail milestone mapping-get <product_id> <version_id>
URL 解析(B · 可选)qa-insights testrail resolve-url <product_id> --url <url>
A preview / executeqa-insights testrail link cases preview … · … link cases execute … --preview-id … --confirm
B preview / executeqa-insights testrail link plans preview … · … link plans execute … --preview-id … --confirm [--supersede]
辅助解析products list、versions list、requirements get、testpoints list(仅缺上下文时)

禁止:cawplan api、链式 &&、直连 TestRail。


Workflow A — Link Cases(CSV refs 回链)

Step动作Detail
0Agent 自检 CSV 导入前提不单独 Ask;同会话 A3 / 用户说「已导入」→ 假定满足;preview 全失败时再引导
1解析 product_id、requirement_id热接力可跳过 A1;缺则 ux.md §Prompts 框 A1
2mappings get;§AutoSuitelink-cases.md §Mappings · §AutoSuite
3§AutoScan(先无 parent_section_id preview)无感 retry ≤1 次;仍失败 → 框 A3s
4展示 preview(含超链接)ux.md §PreviewCases;conflict>0 → 停止
5确认闸(仅 to_link>0)to_link=0 → 不弹;already_linked>0 且全跳过 → 成功说明
6link cases execute --confirmux.md §ResultCases

Step 3–4 合并执行:AutoScan 的首次失败 preview 不对用户展示,直接 retry 或进 A3s。


Workflow B — Link Plans(手工 Plan/Run 绑 Ticket)

Step动作Detail
0解析 product_id、version_id缺则 ux.md §Prompts 框 B1
1milestone mapping-gethas_mapping=false → link-plans.md §MilestoneGate,停止
2收集绑定:Ticket + TestRail Plan/Run URL 或 IDlink-plans.md §CollectBindings · 框 B2
3组装 bindings[];plan_id=0 = Run-onlylink-plans.md §BindingRules
4link plans previewlink-plans.md §PreviewCLI
5展示 preview(含超链接)ux.md §PreviewPlans;supersede_required>0 → 框 B-supersede
6确认闸ux.md §Prompts 框 B-confirm
7link plans execute --confirm(替换时加 --supersede)ux.md §ResultPlans

错误(Agent)

codeWorkflow处理
MILESTONE_NOT_BOUNDBlink-plans.md §MilestoneGate;引导 cawplan-testplan-layout
CONFLICT_BLOCKS_EXECUTEA列 conflicts(ux.md §ConflictMessages);停止
SUPERSEDE_REQUIREDB框 B-supersede;补 --supersede
REQUIREMENT_NOT_FOUND / TICKET_NOT_IN_VERSIONA/Bux.md §Errors
SUITE_NOT_IN_PROJECT / SECTION_*A重走框 A3 / 框 A3s
PLAN_NOT_FOUND / RUN_NOT_FOUND / RUN_NOT_IN_PLANB核对 URL/ID;link-plans.md §CollectBindings
PREVIEW_EXPIREDA/B重新 preview(确认态可复用)
TESTRAIL_UNAVAILABLEA/B勿重复 execute
CONFIRMATION_REQUIREDA/B补 --confirm
auth/403A/Bux.md §Errors

Workflow A 冲突 message 速查(BE 原文 → 见 ux.md §ConflictMessages):

  • TestRail case is already mapped to a different test point — 同 Case 已绑其他测试点
  • TestRail case does not match the case already mapped for this test point — 同测试点已映射其他 Case
  • another TestRail case in this preview claims the same test point and case identity — 本次预览 refs 重复

References

  • ux.md — 路由、Ask 框、TestRail 超链接、Preview/Result 模板、降本、错误
  • link-cases.md — Workflow A:MatchingRules、AutoScan、CLI、preview 字段
  • link-plans.md — Workflow B:Milestone 闸门、bindings 收集、Run-only、supersede

评论

支持 Markdown