当需要测试 RESTful/GraphQL/gRPC/WebSocket 等 API 时使用此技能。覆盖接口的功能验证、参数组合、鉴权绕过、超时重试、幂等性、接口契约和向后兼容性。不要只测 HTTP 状态码——真正的接口 Bug 往往在数据结构不一致、字段类型不匹配、空值处理和并发调用上。输出接口测试矩阵、契约断言清单和工具选型建议。 本技能属于 QA Test Skills 技能集(49 个技能之一),完整工作流体验需安装全套:npx skills add Kokxi/qa-test-skills
浏览器
Http Api Test Runner
试用Build reusable HTTP API test artifacts from user-provided endpoints, authentication, request data, expected results, and validation rules. Use this skill whe...
它能做什么
Build reusable HTTP API test artifacts from user-provided endpoints, authentication, request data, expected results, and validation rules. Use this skill whe...
技能文档
HTTP API Test Runner
Use this skill to turn one-off HTTP checks into reusable .http cases and a runnable verification script.
Generate two artifacts by default:
.api-tests.http.api-verify.sh
The .http file is the source of truth. The shell script executes the cases, prints readable PASS/FAIL/SKIP output, and exits non-zero when any non-skipped case fails.
Quick Start
- Collect only the missing inputs: host, method, auth, request data, cases, and expected results.
- Choose a starting point:
- Use
templates/for a new endpoint. - Use
examples/when the endpoint looks similar to an existing example. - Use
references/complex-scenarios.mdfor multi-step or advanced validation.
- Use
- Generate or update:
.api-tests.http.api-verify.sh
- Validate the generated script:
bash -n './.api-verify.sh'
bash './.api-verify.sh'
COOKIE='full Cookie header' AUTH_TOKEN='token value' bash './.api-verify.sh'
- If cases fail, classify the problem before editing assertions:
- auth mismatch
- request shape mismatch
- environment or fixture mismatch
- business assertion mismatch
See references/debugging-cookbook.md for the failure checklist.
What To Collect
Ask only for fields the user did not already provide.
| Input | Needed for |
|---|---|
| Base URL / host | Resolving request targets |
| HTTP method | Building the request |
| Authentication | Cookie, bearer, custom headers, or none |
| Request data | Path params, query params, JSON body, form body |
| Cases | Positive, negative, auth failure, boundary checks |
| Expected results | Status, JSON path, marker text, list membership, error behavior |
| Output preference | Brief summary, key fields, raw response save path |
For cookie-based tests, tell the user to copy the full Cookie: request header from a successful browser Network request. Do not reconstruct cookies from the storage panel.
Generated comments and final usage notes should follow the user's language.
Choose Your Starting Point
templates/basic.api-tests.http.txt- Fastest path for a new endpoint.
- Includes a small set of common variables and assertions.
templates/basic.api-verify.sh- Runnable shell script with timeout handling, env-based secrets, and formatted output.
examples/resource-detail/- Resource detail lookup with cookie auth and JSON field assertions.
examples/auth-login-required/- Unauthenticated and invalid-auth cases.
examples/list-assertions/- List projection, membership, and absence checks.
examples/async-job-polling/- Submit -> poll -> verify pattern with a runnable pre-step script for async workflows.
Note: publishable skill assets use .http.txt to satisfy upload restrictions, while generated runtime artifacts should still use .api-tests.http.
Artifact Contract
The generated .http file should:
- declare variables such as
@host,@cookie,@token,@resourceId - use
###titles for each case - keep one request per case
- add explicit
expect.*comments - keep real secrets out of the file by default
The generated shell script should:
- read the
.httpfile - resolve
{{variable}}placeholders - accept secrets from environment variables
- print
PASS/FAIL/SKIPoutput for each case - print a summary line
- exit non-zero if any non-skipped case fails
Safety Rules
- Do not commit real cookies, tokens, passwords, or internal credentials.
- Use placeholders such as
@cookie =and@token =. - When secrets are missing, authenticated cases should
SKIPwith a clear reason instead of crashing the parser. - Before publishing or committing generated artifacts, run a lightweight secret scan:
rg -n "password|secret|session_id|auth_token|access_token|refresh_token"
rg -n "Authorization: Bearer [A-Za-z0-9._-]+|C[o]okie: [A-Za-z0-9_%-]+="
Reference Map
- Assertion reference:
references/assertion-cheatsheet.md - Complex flows and advanced validation:
references/complex-scenarios.md - Failure diagnosis and triage:
references/debugging-cookbook.md - Lightweight publishable example:
references/http_test_artifact_example.md
Default Running Checks
After generating artifacts, run:
bash -n './.api-verify.sh'
bash './.api-verify.sh'
COOKIE='full Cookie header' AUTH_TOKEN='token value' bash './.api-verify.sh'
Interpretation:
bash -ncatches shell syntax errors.- Running without secrets should verify parsing and expected
SKIPbehavior. - Running with secrets should verify actual API behavior and assertions.
相关技能
Plan tests for an API endpoint or service — functional, negative, and contract. Use when asked to test an API, write API test cases, plan REST/GraphQL endpoi...
Generate complete automated API test cases from interface documentation such as OpenAPI, Swagger exports, Postman collections, Markdown API docs, or endpoint...
httpSMS (httpsms.com). Use this skill for ANY httpSMS request — reading, creating, updating, and deleting data. Whenever a task involves httpSMS, use this skill instead of calling the API directly.
Expose installed agent Skills as HTTP(S) REST API services. Runs a persistent FastAPI server that auto-generates an API endpoint per Skill, with sync/async execution, webhook callbacks, and a multi-engine sub-agent executor (OpenClaw / Claude Code / Codex CLI / LLM fallback). Ships a bilingual (EN/ZH) web management console. HTTP by default (zero-friction), optional HTTPS with self-signed SAN certificates for production. Use when you need to serve Skills over HTTP, call Skills remotely, or expose Skill capabilities to external systems.
Write clear, developer-facing API documentation. Use when asked to document an API endpoint, write API reference docs, create a developer guide, or turn a ra...