AI-powered E2E testing tool with natural language test case generation
npm install @toby1123yjh/test-cliAI 驱动的 E2E 测试 CLI:通过 /generate//update 生成可运行的测试脚本,通过 /run 执行并输出 Markdown/HTML 报告。
``bash`
npm install -g @toby1123yjh/test-cli
- 用官方 npmjs 装:npm i -g @toby1123yjh/test-cli@latest --registry=https://registry.npmjs.org/
- 用你当前 taobao 镜像装:npm i -g @toby1123yjh/test-cli@latest --registry=https://registry.npm.taobao.org/
- Node.js >= 18
- 前端 UI 测试需要 Playwright(建议 npm i -D playwright && npx playwright install)
- Git 可选
目录结构``
.test-cli/
├── config.yaml
├── cases/
│ └──
│ ├── case.yaml
│ └── script/
│ ├── test.spec.ts # frontend (Playwright)
│ └── test.api.mjs # backend (Node + fetch)
└── tests/
└──
├── report.md
├── report.html
└── artifacts/
1) 启动交互式 CLI:
`bash`
test-cli
2) 生成并加载配置(会创建 .test-cli/config.yaml、.test-cli/cases/、.test-cli/tests/):
``
/config
3) 编辑 .test-cli/config.yaml(示例):
`yaml
project:
name: "my-app"
baseUrl: "http://localhost:3000"
provider:
# openai | anthropic | gemini | deepseek
provider: "openai"
model: "gpt-4o-mini"
# apiKey: ${OPENAI_API_KEY}
`
4) 生成测试:
- 前端:
``
/generate login https://example.com/login
- 后端(需要 project.baseUrl 或在提示里包含 URL):
``
/generate api
5) 运行测试(模块可选;不传则跑所有可运行模块):
``
/run
/run login
报告输出在 .test-cli/tests/。
| 命令 | 说明 |
|------|------|
| /help | 显示命令列表 |/clear
| | 清屏 |/config
| | 创建/重载 .test-cli/config.yaml 并准备目录 |/generate
| | 生成 case.yaml + 可运行脚本 |/update
| | 更新 case.yaml 并重新生成脚本 |/validate [file] [--dir
| | 校验 case.yaml(主要用于 frontend case) |/run [module] [--mode frontend|backend] [--filter ...] [--timeout ...]
| | 执行脚本并生成报告 |/new
| | 已废弃(请使用 /generate) |
`bash与 /run 等价
test-cli run [module] [--mode frontend|backend] [--filter "..."]
开发
`bash
pnpm install
pnpm test
pnpm typecheck
pnpm build
``MIT