tester v2: 术语对齐 pytest/JUnit/Robot,补齐 automation 与 not-run

字段改名(每项取舍的理由见新增的 references/concepts.md):
- 用例 status -> lifecycle, suite -> tag, surface -> driver,
  cleanup -> teardown, skip_unless -> assume;删除 requires
- risk 取值 safe/act/harm -> readonly/mutating/destructive(单调三级,
  与 gate 正交)
- catalog auth_env -> authorize;授权变量统一为
  AUTHORIZE_MUTATING / AUTHORIZE_DESTRUCTIVE

新增用例字段 automation(automated/assisted/manual),默认 automated,
并在 validate 里机器校验:manual 禁用 driver 与 how.run 且必须有
how.steps;assisted 至少一步以 [人工] 开头。select 新增 --automation。

结果词新增 not-run,区分「主动不跑」(skipped:retired/pending/超风险
上限/未授权/assume 不成立)与「没轮到」(失败即停后、被分类前置挡住整组、
需人工而无人值守)。

status_probe 定为分类级前置条件:catalog 顶层为默认,categories[] 同名键
覆盖(缺省继承 / false 关闭 / mapping 整体替换)。select 按分类返回生效值,
并把 probe.url 用 vars 展开(solve Agent 无法自行解析 ${VAR} 的问题),
同批返回 vars 供 how 里的 ${...} 替换。

新增 references/concepts.md:术语表(每词一句唯一定义 + 业界锚点 +
反例)、v1->v2 映射、以及 risk/automation/not-run/status_probe 的设计理由。
其余文档(SKILL/README/schema/levels/run/maintain)与三个脚本(catalog、
generate_cases_csv、generate_run_csv)同步更新。
This commit is contained in:
2026-09-16 23:07:08 +08:00
parent ca3156ed93
commit cc9af04a40
12 changed files with 443 additions and 143 deletions
+8 -7
View File
@@ -11,7 +11,7 @@ description: >-
开始时解析本 `SKILL.md` 所在目录为 `<skill-dir>`。项目根用
`git rev-parse --show-toplevel`。目录固定为 `<root>/.pouch/tester/`。
用脚本读写目录,不要把 `cases/` 整库灌进上下文:
用脚本读写目录,不要把 `cases/` 整库灌进上下文。术语与命名理由见 [references/concepts.md](references/concepts.md):
```bash
python3 <skill-dir>/scripts/catalog.py <list|select|show|validate|next-id|run-script> \
@@ -31,8 +31,9 @@ python3 <skill-dir>/scripts/catalog.py <list|select|show|validate|next-id|run-sc
- 不猜 HOST / Base URL / 是否已授权。缺 HOST 则停,记 environment-fail,不用 localhost。
- 默认风险上限是 catalog 里的 `default_max_risk`。超出上限的条目标 `skipped`,禁止执行。
- `risk` 只能是 `safe` / `act` / `harm`。`suite=smoke` 只能配 `risk=safe`。规则见 [levels.md](references/levels.md)。
- `surface=browser` 必须开真实页面;`surface=mobile` 必须挂模拟器 session。二者都不得改成只打 API。
- `risk` 只能是 `readonly` / `mutating` / `destructive`,默认只跑 `readonly`。`tag=smoke` 只能配 `risk=readonly`。规则见 [levels.md](references/levels.md)。
- `driver=browser` 必须开真实页面;`driver=mobile` 必须挂模拟器 session。二者都不得改成只打 API。
- `automation=assisted|manual` 需要人在场:无人值守时记 `not-run`,不要自己代跑人工步骤。见 [concepts.md](references/concepts.md)。
- 浏览器、移动模拟器按 catalog `sessions` 初始化一次,同一次运行内复用。
- 环境失败(连不上、缺浏览器、下游超时、session 挂了)不是产品失败。
- 不改产品代码,不提交,不把成绩单当操作手册。
@@ -67,7 +68,7 @@ python3 <skill-dir>/scripts/catalog.py list --root <project-root>
python3 <skill-dir>/scripts/generate_cases_csv.py --root <project-root>
```
`list` 结束时也会跑它。告诉用户路径 `.pouch/tester/cases.csv`。不要手改 CSV,改用例走「维护」后再生成。有运行快照时,这份 CSV 末尾有 `last_result` / `last_executed`(`yes` 已跑,`no` 跳过,空=未进入最近一次运行)。
`list` 结束时也会跑它。告诉用户路径 `.pouch/tester/cases.csv`。不要手改 CSV,改用例走「维护」后再生成。有运行快照时,这份 CSV 末尾有 `last_result` / `last_executed`(`yes` 已跑,`no` 未跑——含 `skipped` 与 `not-run`,空=未进入最近一次运行)。
## 查看
@@ -75,7 +76,7 @@ python3 <skill-dir>/scripts/generate_cases_csv.py --root <project-root>
python3 <skill-dir>/scripts/catalog.py show --root <project-root> --id <CASE_ID>
```
只展示这一条的 how / expected / risk / surface。字段对不上时再读 [schema.md](references/schema.md)。
只展示这一条的 how / expected / risk / driver / automation。字段对不上时再读 [schema.md](references/schema.md)。
## 检查
@@ -83,8 +84,8 @@ python3 <skill-dir>/scripts/catalog.py show --root <project-root> --id <CASE_ID>
## 维护
读 [maintain.md](references/maintain.md)。写 `suite`/`risk` 时读 [levels.md](references/levels.md)。先 `show` 或 `next-id`,拟好条目给用户确认再写文件,然后 `validate`。
读 [maintain.md](references/maintain.md)。写 `tag`/`risk`/`automation` 时读 [levels.md](references/levels.md) 与 [concepts.md](references/concepts.md)。先 `show` 或 `next-id`,拟好条目给用户确认再写文件,然后 `validate`。
## 运行
读 [run.md](references/run.md)。先 `select` 得到命中列表,再按 surface 分流。未指定范围时等同「suite=smoke 且风险上限=默认」。`select` 的 `run_together` 组按 [run.md](references/run.md) 整组执行。
读 [run.md](references/run.md)。先 `select` 得到命中列表,再按 driver 分流。未指定范围时等同「tag=smoke 且风险上限=默认且 automation=automated」。`select` 的 `run_together` 组按 [run.md](references/run.md) 整组执行。