最近在折腾“验收自动化”时一个反复踩的坑:
所以做了个小工具: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 。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.