首页
/ 1. Adding New Todos

1. Adding New Todos

2026-09-06 18:21:51作者:羿妍玫Ivan

1. Adding New Todos

Seed: tests/seed.spec.ts

1.1 Add Valid Todo

Steps:

  1. Click in the "What needs to be done?" input field

1.2 Add Multiple Todos

...


契约要点包括:

- 顶层用 `### N.` 表示**测试套件分组**(如"Adding New Todos"),并在 `**Seed:**` 行标注该分组依赖的 seed 文件;
- 组内用 `#### N.M` 表示**具体用例**(如 1.1、1.2),`**Steps:**` 下列出编号操作步骤;
- 生成器生成代码时,用例编号只用于索引与顺序遍历,套件/用例的"正文名称"会去掉序号后原样使用(对应生成参数里的 `<test-suite>` 与 `<test-name>`)。

也就是说,`playwright-test-plan.prompt.md` 中"`Create test plan for ...` → `specs/coverage.plan.md`"的两行,本质上是这条"计划即文档、文档即驱动"数据流的最前端入口。

## 覆盖流水线:Planner → Generator → Healer

`playwright-test-plan.prompt.md` 是流水线第一棒的触发模板,而整条流水线的编排说明记录在同目录的 `packages/playwright/src/agents/playwright-test-coverage.prompt.md` 中(其 frontmatter 的 `agent` 字段为 `${defaultAgentName}`,表示它面向顶层/默认 Agent 而非某个子 Agent)。流水线共三步:

**第 1 步——规划**:顶层 Agent 以如下 XML 载荷调用 `#playwright-test-planner` 子 Agent:

```

其中 <task-text> 就是"为'加入购物车'功能创建测试计划"这类业务诉求,<plan-file> 默认指向 specs/ 下的计划文件——这正是规划器 Prompt 模板生成的产物路径。

第 2 步——生成:逐条读取测试计划中的用例(1.1、1.2、……),串行而非并行地调用 #playwright-test-generator 子 Agent,每次携带一个用例:

<generate>
  <test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
  <test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name>
  <test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file>
  <seed-file><!-- Seed file path from test plan --></seed-file>
  <body><!-- Test case content including steps and expectations --></body>
</generate>
登录后查看全文
热门项目推荐
相关项目推荐