Playwright推出了自己的Agents来实现测试从测试用例到自我调试失败用例的全流程。
https://playwright.dev/docs/test-agents

Agents会创建三个文件:Planner, Generator, Healer
Planner role 会产生一个Markdown格式的 test plan
Generator role 会根据 test plan生成playwright test files
Healer role 会执行测试套件和自动修复失败用例

使用这个Agents很方便,以vscode举例【npx playwright init-agents --loop=vscode】,仅支持vscode v1.105

Planner:
INPUT:一个 seed test文件包含连通app需要的配置环境。提供FRD文件。
PROMPT: 一个清晰命令‘为XXX软件的XX功能生成一个测试计划’
OUTPUT:一个Markdown test plan saved as /specs/basic-operations.md

Generator:
INPUT: the OUTPUT from Planner. /specs
PROMPT: “为XXXsection创建一个测试计划”
OUTPUT:A test suite under /tests/

Healer:
INPUT: Failing test name
PROMPT:Fix the test
OUTPUT: A passing test, or a skipped test if the healer believes the that functionality is broken. -- 发现BUG

载入Playwright Agents以后,会自动加载MCP及相组件。会自动在目录生成相关文件。
repo/
.github/ # agent definitions
specs/ # human-readable test plans
basic-operations.md
tests/ # generated Playwright tests
seed.spec.ts # seed test for environment
tests/create/add-valid-todo.spec.ts # detailed test case
playwright.config.ts

seed.spec.ts是seed tests,是一个上下文储存的地方,用于调用执行。

一编。接下来尝试应用到具体的测试项目中,看一下表现。

posted on 2025-11-03 17:14  二咩rw  阅读(137)  评论(0)    收藏  举报