qa-test-cli
v0.2.11
Published
AI QA Agent Platform — Skills-driven 8-stage test automation workflow CLI
Readme
qa-test — AI-Powered 8-Stage QA Automation Platform
A Skills-driven test automation platform. Describe your test goals in natural language, and AI drives the full QA lifecycle — requirement analysis → feature breakdown → test case generation → environment setup → execution → human review → regression → report — with mandatory human approval at every stage.
npm install -g qa-test-cli # Install
cd your-project && qa-test init # Deploy Skills to your AI platform
/qa-test "User login with email/password and remember-me" # Start testing (in AI chat)Quick Start
Prerequisites
| Requirement | Version | Notes |
|-------------|---------|-------|
| Node.js | >= 18 | Required for CLI |
| npm | >= 9 | Ships with Node.js |
| AI Platform | Any | OpenCode, Claude Code, or Cursor |
| OpenAI API Key | — | Only needed for src/llm/ integration |
Install
# Install globally
npm install -g qa-test-cli
# Verify installation
qa-test --version
# → 0.1.0Or install from source for customization:
git clone https://github.com/zhangjinglei137/qa-master.git
cd qa-master
npm install
npm run build
npm linkDeploy Skills
# In your project directory, deploy QA Skills to your AI platform
qa-test initqa-test init auto-detects which AI platforms are present and copies the 8 stage Skills + methodology references:
| Platform | Skill Directory |
|----------|----------------|
| OpenCode | .opencode/skills/qa-test*/ |
| Claude Code | .claude/skills/qa-test*/ |
| Cursor | .cursor/skills/qa-test*/ |
Use qa-test init --force to overwrite existing Skills.
Start a Test Session
Inside your AI platform's chat (after Skills are deployed):
/qa-test Develop a user registration feature with email verification and password strength validationThe AI automatically detects the current phase from .qa-test.yaml and dispatches to the correct stage Skill.
CLI Commands
The qa-test CLI manages project setup, progress tracking, and phase transitions.
| Command | Description |
|---------|-------------|
| qa-test init | Detect AI platform and deploy Skills; creates platform directories if none detected |
| qa-test init --force | Force overwrite existing Skills |
| qa-test status | Display current 8-stage progress with markers and artifact paths |
| qa-test run [requirement] | Start or resume a QA workflow; optional requirement text |
| qa-test confirm | Confirm current stage and advance to the next phase |
| qa-test next | Show the upcoming phase without advancing |
| qa-test --version | Print version |
qa-test status Output Example
┌─────────────────────────────────────────┐
│ QA Test 工作流进度 │
├─────────────────────────────────────────┤
│ ✓ 需求分析 → artifacts/login/requirement/requirement-20260705.md
│ ✓ 功能拆分 → artifacts/login/function/function-20260705.md
│ ▶ 测试用例生成
│ 环境准备
│ 测试执行
│ 人工审查
│ 回归测试
│ 报告生成
├─────────────────────────────────────────┤
│ 会话: a1b2c3d4 | 工作流: full │
└─────────────────────────────────────────┘Markers: ✓ confirmed, ▶ current, ? skipped/pending, future.
8-Stage Workflow
Each stage is a self-contained Skill that the AI platform reads and executes. Every stage ends with a HARD-GATE — a structured multiple-choice confirmation menu requiring explicit user input before advancing.
| # | Phase | Skill | Description |
|---|-------|-------|-------------|
| 1 | requirement | /qa-test-requirement | Parse natural language requirements, detect actors/acceptance criteria/business rules, run Red Flag analysis, generate follow-up questions |
| 2 | function | /qa-test-function | Break features into atomic units, assign priority (P0–P3), output function breakdown document |
| 3 | testcase | /qa-test-testcase | Generate test cases using BVA, equivalence partitioning, error guessing; IEEE 829 format |
| 4 | prepare | /qa-test-prepare | Explore target site via Playwright MCP, build sitemap, snapshot pages, verify environment |
| 5 | execute | /qa-test-execute | Execute tests (Playwright script generation or MCP single-step), record PASS/FAIL/BLOCK |
| 6 | review | /qa-test-review | AI flags suspicious results (OCR/Toast/animation/captcha), human reviews and confirms each |
| 7 | regression | /qa-test-regression | Re-run FAIL/BLOCK cases, reuse generated Playwright scripts, verify fixes |
| 8 | report | /qa-test-report | Aggregate all artifacts, generate multi-format report (Markdown/JSON), produce go-live recommendations |
HARD-GATE Confirmation
Instead of free-text "reply 'confirm' to continue", each stage uses a structured multiple-choice menu via the AI platform's native question tool:
┌─ 确认进入下一阶段 ───────────────────┐
│ 测试用例生成完成。总计: 42 条. │
│ │
│ 1. 确认, 进入环境准备 (Recommended) │
│ 2. 补充缺失的测试用例 │
│ 3. 修改用例覆盖范围 │
│ 4. 自定义... │
└──────────────────────────────────────┘This ensures deterministic parsing and prevents accidental stage transitions.
State Management
All workflow progress is tracked in .qa-test.yaml at the project root, managed by the WorkflowEngine (TypeScript state machine in src/workflow/engine.ts).
Example State File
workflow: full
phase: testcase
auto_transition: false
archived: false
requirement_artifact: "artifacts/login/requirement/requirement-20260705.md"
function_artifact: "artifacts/login/function/function-20260705.md"
testcase_artifact: null
prepare_artifact: null
execute_artifact: null
review_artifact: null
regression_artifact: null
report_artifact: null
execute_result: pending
review_result: pending
regression_result: pending
test_session_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
confirmed_stages: ["requirement", "function"]
handoff_context: null
handoff_hash: nullField Reference
| Field | Type | Description |
|-------|------|-------------|
| workflow | "full" | "hotfix" | Workflow mode |
| phase | QaTestPhase | Current stage (requirement to report) |
| auto_transition | boolean | Reserved for experienced users; default false |
| archived | boolean | Whether the session is archived |
| *_artifact | string \| null | Path to each stage's output artifact |
| execute_result | "pending" | "pass" | "fail" | "block" | Execution stage result |
| review_result | Same | Review stage result |
| regression_result | Same | Regression stage result |
| test_session_id | string \| null | UUID v4 session identifier |
| confirmed_stages | string[] | Stages that have passed HARD-GATE confirmation |
| handoff_context | string \| null | Cross-stage handoff payload |
| handoff_hash | string \| null | Integrity hash for handoff context |
The state file supports resume: exit at any point and the next /qa-test or qa-test run continues from the current phase.
Architecture
┌───────────────────────────────────────────────────────────┐
│ AI Platform Chat │
│ (OpenCode / Claude Code / Cursor) │
│ │
│ /qa-test <requirement> │
│ │ │
│ ▼ │
│ Entry Skill ──phase dispatch──► Stage Skill (x8) │
│ (skills/qa-test) │ │
│ │ reads/writes │
│ ▼ │
│ HARD-GATE (question tool) │
│ │ │
│ ▼ │
│ WorkflowEngine │
│ (src/workflow/engine.ts) │
│ │ │
│ ▼ │
│ .qa-test.yaml │
│ (state persistence) │
└───────────────────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────┐
│ CLI (qa-test) │
│ init — deploy Skills to AI platform directories │
│ status — print progress table from .qa-test.yaml │
│ confirm — advance state machine to next phase │
│ run — start or resume workflow │
└───────────────────────────────────────────────────────────┘Skill Structure
Each stage Skill has a two-layer design:
skills/qa-test-testcase/
├── SKILL.md # Decision Core: triggers, workflow, HARD-GATE
└── references/
└── examples.md # Reference Appendix: input/output examples
skills/methodology/ # Test methodologies (auto-loaded by Skills)
├── boundary-value.md # Boundary Value Analysis
├── equivalence-partitioning.md # Equivalence Partitioning
└── error-guessing.md # Error Guessing + 12-category defect taxonomyKey Components
| Component | Path | Role |
|-----------|------|------|
| WorkflowEngine | src/workflow/engine.ts | TypeScript state machine - phase transitions, artifact tracking, session management |
| CLI | src/cli/index.ts | Commander-based CLI (init, status, run, confirm, next) |
| SkillLoader | src/skills/loader.ts | Parses YAML frontmatter from Markdown Skill files |
| LLM Service | src/llm/index.ts | OpenAI API integration for AI-powered analysis |
| Playwright Adapter | src/tools/playwright/index.ts | MCP client adapter for browser automation |
| Config | src/config/index.ts | YAML config load/save with defaults |
| i18n | src/i18n/ | Multi-language support (en, zh-CN) |
Test Methodology
Three ISTQB-aligned test design methodologies are built in as Skill references, auto-loaded during test case generation:
| Methodology | Key Contents | |-------------|-------------| | Boundary Value Analysis | 3-point method (min-1/min/max/max+1), covering 6 categories: numeric/string/collection/date/file/composite | | Equivalence Partitioning | Valid/invalid partitions, 5 partitioning methods (range/type/boolean/enum/time) | | Error Guessing | 12-category defect taxonomy (null/injection/concurrency/auth/network...), per-field inspection |
Project Structure
qa-master/
├── dist/ # Built output (tsup, single ESM)
├── commands/
│ └── qa-test.md # OpenCode command definition
├── skills/
│ ├── qa-test/ # Entry Skill (phase detection + dispatch)
│ │ ├── SKILL.md
│ │ └── references/
│ │ ├── decision-point.md # 8-stage decision point protocol
│ │ └── state-fields.md # .qa-test.yaml field reference
│ ├── qa-test-requirement/ # Stage 1: Requirement analysis
│ ├── qa-test-function/ # Stage 2: Feature breakdown
│ ├── qa-test-testcase/ # Stage 3: Test case generation
│ │ └── references/examples.md
│ ├── qa-test-prepare/ # Stage 4: Environment setup
│ ├── qa-test-execute/ # Stage 5: Test execution
│ ├── qa-test-review/ # Stage 6: Human review
│ ├── qa-test-regression/ # Stage 7: Regression testing
│ ├── qa-test-report/ # Stage 8: Report generation
│ └── methodology/ # ISTQB test design references
│ ├── boundary-value.md
│ ├── equivalence-partitioning.md
│ └── error-guessing.md
├── src/
│ ├── index.ts # Entry point (qa-test CLI)
│ ├── types.ts # Core type definitions (QaTestPhase, Config, etc.)
│ ├── cli/
│ │ ├── index.ts # Commander CLI setup
│ │ ├── installer.ts # Skill deployment to AI platforms
│ │ ├── intent.ts # Intent detection from natural language
│ │ └── status.ts # Progress display
│ ├── workflow/
│ │ └── engine.ts # WorkflowEngine state machine
│ ├── skills/
│ │ └── loader.ts # YAML frontmatter parser
│ ├── tools/
│ │ ├── registry.ts # Tool registry
│ │ ├── types.ts # Tool interfaces
│ │ └── playwright/
│ │ └── index.ts # Playwright MCP adapter
│ ├── llm/
│ │ └── index.ts # OpenAI LLM provider
│ ├── config/
│ │ └── index.ts # YAML config load/save
│ └── i18n/
│ ├── index.ts # i18n setup (setLocale, t)
│ ├── en.ts # English locale
│ └── zh-CN.ts # Chinese locale
├── tests/
│ ├── skills.test.ts # SkillLoader tests
│ └── tools.test.ts # ToolRegistry + PlaywrightTool tests
├── package.json # npm package: qa-test-cli
├── tsconfig.json
├── tsup.config.ts # Build config (ESM, single file)
└── .qa-test.yaml # Workflow state (generated at runtime)Development
# Clone
git clone https://github.com/zhangjinglei137/qa-master.git
cd qa-master
# Install dependencies
npm install
# Build for production
npm run build # tsup -> dist/index.js
# Development mode (watch)
npm run dev # tsup --watch
# Run tests
npm test # vitest run
# Watch tests
npm run test:watch # vitestCI / Publish
npm run prepublishOnly # builds before publish
npm publish # publishes to npm (only dist/ + skills/ + commands/)Troubleshooting
"qa-test: command not found"
Ensure global installation was successful:
npm list -g --depth=0
# → should show [email protected]If missing, reinstall: npm install -g qa-test-cli. If installed from source, run npm link in the project root.
Skills not showing up in AI platform chat
Run qa-test init --force to redeploy. Verify the skills directory exists:
ls .opencode/skills/qa-test-*/
# → should list 9 directories (qa-test + 8 stage Skills)If the AI platform directory doesn't exist, qa-test init creates it automatically.
.qa-test.yaml says "archived: true" but I want to start a new test
Delete or rename the existing .qa-test.yaml and run /qa-test <requirement> again:
mv .qa-test.yaml .qa-test.yaml.bak
# then restart in AI chat: /qa-test <new requirement>"OpenAI API key not set" error
The LLM integration (src/llm/) requires an OpenAI API key. Set it as an environment variable:
export OPENAI_API_KEY=sk-...
# or set OPENAI_BASE_URL for a compatible endpointThis is only needed when using direct LLM-based analysis features. The core workflow (Skills + CLI) works without it.
License
MIT
