最近在折腾“验收自动化”时一个反复踩的坑:
所以做了个小工具:AutoQA-Agent(开源 CLI )。核心思路是 Docs-as-Tests (文档即测试):
@playwright/test 用例(可接 CI )specs/*.mdautoqa run <spec-or-dir> --url <baseUrl>.autoqa/runs/<runId>/( log/screenshot/snapshot/trace )tests/autoqa/*.spec.tsgit clone https://github.com/terryso/AutoQA-Agent.git
cd AutoQA-Agent
npm install
npm run build
npm link # 可选,全局使用 autoqa
autoqa init
# 跑一个示例(仓库里有 SauceDemo 用例)
autoqa run specs/saucedemo-01-login.md --url https://www.saucedemo.com/
# 本地观察执行过程
autoqa run specs/saucedemo-01-login.md --url https://www.saucedemo.com/ --debug
# Login
## Preconditions
- Test account exists
## Steps
1. Navigate to /login
2. Verify the login form is visible
3. Fill the username field with standard_user
4. Fill the password field with secret_sauce
5. Click the "Login" button
6. Verify the user is redirected to dashboard
说明:
--url 提供( Preconditions 里的 Base URL 只做可读性)Verify/Assert(也支持“验证/断言”)开头的步骤会识别为断言ref)每次运行会落盘:
.autoqa/runs/<runId>/
├── run.log.jsonl
├── ir.jsonl
├── screenshots/
├── snapshots/
└── traces/
.env + 模板变量思路)我比较关心的问题:
Repo: https://github.com/terryso/AutoQA-Agent
欢迎提 Issue / PR 。