Testany pipeline

From TestAny-io/testany-agent-skills · View interactive version

Testany pipeline is an AI agent skill from the GitHub repository TestAny-io/testany-agent-skills. Testany pipeline 编排与 CRUD - 基于 automation design 或现有 case keys 创建执行与编排单元

How to use this skill

Skill file

Testany Pipeline

本 skill 通过 Testany MCP 工具管理 Testany 平台上的 pipeline。

平台对象操作通过远程 API;允许为本次编排读取本地 handoff、生成和静态检查 YAML。这不授权执行测试或返回的命令。

关键前提:

用户输入: $ARGUMENTS


宿主能力适配


先统一心智模型

使用本 skill 前,先按 automation-model.md 理解边界:

重要结论:


上游输入优先级

按以下优先级选择输入模式:

  1. Primary:automation design / decomposition
  1. Secondary:用户明确给出的 case keys + 依赖描述
  1. Fallback:从现有 case metadata 反推

操作速查

| 用户意图 | 操作类型 | 工具 |

|---------|---------|------|

| 创建新 pipeline | Create | testany_create_pipeline |

| 查看 pipeline 详情 | Read | testany_get_pipeline |

| 查看 pipeline YAML | Read | testany_get_pipeline_yaml |

| 搜索/列出 pipelines(按 workspace) | Read | testany_list_pipelines |

| 列出我的 pipelines(按 workspace) | Read | testany_list_my_pipelines |

| 修改 pipeline 配置 | Update | testany_update_pipeline |

| 删除 pipeline | Delete | testany_get_pipeline_used_by → testany_delete_pipeline |

| 验证 YAML 语法 | Validate | testany_verify_pipeline |

| 检查被引用情况 | Query | testany_get_pipeline_used_by |


Create(创建)

本地 YAML 检查、远程验证与执行分开,遵循 交付验证。创建后按真实 key 读回配置及需要的 YAML,核对名称、workspace、case 引用与本次编排;accepted 不等于配置已一致,更不等于执行成功。

创建与依赖新 key 的调用存在数据依赖:先取得并检查创建响应,再将实际 pipeline_key 传给验证、读回或执行。不要在创建前把示例/猜测 key 填进同一批调用;&& 只保证前一命令成功,不会把新 key 自动传给后一命令。脚本编排可解析响应并检查非空 key 后继续,缺失或不确定时停止相关调用。

Phase 0: 先判断输入模式

Primary:已有 automation design / decomposition

如果上游已给出以下内容,直接按它编排:

Secondary:用户已明确给出 case keys 与顺序

如果用户直接给出:

则直接进入 YAML 构建。

Fallback:只能从现有 cases 反推

仅在没有上游 design 时使用:


Phase 1: 准备数据

并行获取:

如果用户还没有把 platform cases 注册到 Testany 平台:


Phase 2: 构建 pipeline 设计

根据输入模式,确定:

何时使用 `case_keys`

仅当满足以下条件时,允许直接用 case_keys 自动生成简单顺序 pipeline:

何时必须手写 YAML

出现以下任一情况时,必须显式生成 YAML:


Phase 3: 验证 relay 与依赖

如有 relay,必须:

  1. testany_get_case 检查源 case 是否有 type='output' 变量
  2. testany_get_case 检查目标 case 是否有 type='env' 变量
  3. 确保源 case 在 rules 中位于目标 case 之前
  4. 确保 relay 不与 whenFailed 组合
  5. 禁止把 type='secrets' 行作为 relay 源或目标:secrets 的值来自 workspace Credential Safe,不经过 relay 传递;目标端也不能被 relay 覆写。如果 relay 源/目标命中 secrets 行,停下来向用户说明并请求改用 env 或 output 行

Phase 4: 创建 pipeline

调用 testany_create_pipeline:

| 参数 | 必填 | 说明 |

|------|-----|------|

| name | 是 | pipeline 名称 |

| workspace | 是 | 所属工作空间 key |

| description | 否 | 描述 |

| definition | 否 | Pipeline YAML 配置 |

| case_keys | 否 | Case keys 数组(仅简单顺序场景) |


Phase 5: 验证

调用 testany_verify_pipeline:


Fallback:从现有 cases 反推(仅兜底)

当且仅当前两种输入模式都不存在时,才允许从现有 cases 反推。

可用于判断的信息

| 字段 | 用途 | 可靠程度 |

|------|------|---------|

| case_labels | 按 User Story 编号、功能模块筛选 | 高 |

| description | 理解动作、前置条件、验证目标 | 中 |

| environment_variables[].description | 理解输入/输出变量语义 | 中 |

| name | 辅助判断 | 低 |

禁止猜测

如果仍然无法确定:

必须向用户确认,而不是猜测。


Read(查询)

| 场景 | 工具 | 说明 |

|------|------|------|

| 获取 pipeline 详情 | testany_get_pipeline | 传入 pipeline key |

| 获取 YAML 内容 | testany_get_pipeline_yaml | 传入 pipeline key |

| 搜索/列出 pipelines(按 workspace) | testany_list_pipelines | workspace 必填 |

| 仅列出我的 pipelines(按 workspace) | testany_list_my_pipelines | workspace 必填 |


Update(更新)

可更新的字段

| 参数 | 说明 |

|------|------|

| name | pipeline 名称 |

| description | 描述 |

| definition | YAML 定义 |

| case_keys | 简单顺序执行的 case keys |

| environments | 环境标签列表 |

| owned_by | 所有者邮箱 |

| pipeline_labels | Pipeline 标签列表 |

更新流程

  1. testany_get_pipeline 读取当前配置
  2. testany_get_pipeline_yaml 读取当前 YAML(如需修改编排)
  3. 优先按已有 automation design 更新,而不是现场重猜
  4. 如修改 YAML,重新验证 relay 与依赖
  5. testany_update_pipeline 提交更新
  6. testany_get_pipeline 读回授权字段;改了编排时再读 YAML 核对。读回仍为旧值或不可读时报告未验证/不一致,不自动重试、执行或删除

Delete(删除)

删除前必须检查引用情况:

  1. testany_get_pipeline_used_by
  2. 如被 Plan / Manual Trigger / Gatekeeper 引用,先提示用户解除引用
  3. 无引用后再删除

警告:此操作不可撤销。


常见问题处理

| 场景 | 处理方式 |

|------|---------|

| 用户只有场景,没有已注册 case | 先去 testany-case-writing + testany-case |

| 用户只有一个 case,想直接执行 | 仍需创建一条单 case pipeline |

| 有 relay 但没给清楚源/目标 | 回到上游确认 decomposition |

| 只有现有 case 库,没有 design | 可 fallback 反推,但必须让用户确认 |

| 用户想配置什么时候运行 | 切到 testany-trigger |

| 用户想立即执行 pipeline | 切到 testany-trigger |

| 用户想看 execution 进度或历史 | 切到 testany-execution |


返回格式

任务完成后,向用户汇报:


参考文档

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.