
E2e Testing
Guide for running end-to-end tests of the Qwen Code CLI, including headless mode, MCP...
Install
npx skills add QwenLM/qwen-code --skill e2e-testing -g -a claude-code -y- Repository
- QwenLM/qwen-code28.9k
- Category
- Testing
- Updated
- 3d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 1,961 tokens
- Runs scripts
- Yes, review before use
What it does
Guide for running end-to-end tests of the Qwen Code CLI, including headless mode, MCP server testing, and API traffic inspection. Use this skill whenever you need to verify CLI behavior with real model calls, reproduce user-reported bugs end-to-end, test MCP tool integrations, or inspect raw API request/response payloads. Trigger on mentions of E2E testing, headless testing, MCP tool testing, or reproducing issues.
E2E Testing Guide
How to run the Qwen Code CLI end-to-end, from building the bundle to inspecting raw API traffic. Use when unit tests aren't enough and you need to verify behavior through the full pipeline (model API → tool validation → tool execution).
Setup
Which binary to use
- Reproducing bugs: use the globally installed
qwencommand, this matches what the user ran when they filed the issue. - Verifying fixes: build first (
npm run build && npm run bundle), then runnode dist/cli.js, this tests your local changes. - Runtime-only checks (fastest):
npm run dev -- "<prompt>" <flags>, runs TS source via tsx, no build. Usebuild && bundle+node dist/cli.jsonly when the shipped artifact itself matters. (<qwen>below can benpm run dev --.)
Running against a real model
Headless auth comes from ~/.qwen. Force a known-good model with --auth-type +
--model:
<qwen> "your prompt" --auth-type openai --model deepseek-v4-flash \
--approval-mode yolo --output-format json
Gotcha: --model alone won't switch providers, --auth-type (openai/anthropic/qwen-oauth/gemini/vertex-ai) does. Omit it and the run falls back to the default provider and dies
on its missing key.
Isolating runtime artifacts
QWEN_RUNTIME_DIR=<dir> redirects qwen's runtime output, tmp/, debug/,
and projects/<sanitized-cwd>/... (chat recordings, auto-memory, history), into <dir> instead of ~/.qwen. Config (settings.json, OAuth tokens,
commands/) still reads from ~/.qwen, so real auth and provider config
work without any setup.
Use when repeated test runs would clutter your real chat history or auto-memory. Skip when the bug you're reproducing depends on the user's actual history or runtime state, that is the repro.
QWEN_RUNTIME_DIR=/tmp/test-1/runtime <qwen> "prompt" ...


