원클릭으로
qa-httpx-writer
Generate httpx/requests API tests for Python with async support, session management, and schema validation using pytest.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate httpx/requests API tests for Python with async support, session management, and schema validation using pytest.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Master skill coordinating all QA skills through pipeline modes (full-cycle, docs-only, testcases-only, write-tests, report), formalized handoff chains, scheduler rules, and framework/language selection based on project context.
QA project memory with auto-update. Structured log of bugs, decisions, tests, regressions, environments. Automatically updated after every QA task. Archive system with searchable index for large projects. Trigger phrases (EN): "initialize memory", "init qa memory", "find known bug", "search memory", "show what was done", "check regressions", "memory status", "archive memory", "log a bug", "add decision", "memory summary", "what bugs do we know", "update memory", "show test log". Trigger phrases (UA): "ініціалізувати пам'ять", "знайти відомий баг", "пошук у пам'яті", "показати що було зроблено", "перевірити регресії", "статус пам'яті", "архівувати пам'ять", "залогувати баг", "додати рішення", "зведення пам'яті", "які баги відомі", "оновити пам'ять", "показати лог тестів", "що ми вирішили про", "які тестові середовища є".
Analyze OpenAPI/Swagger spec (JSON or YAML) against existing test files and generate an HTML coverage report with QA automation tasks. Use when user provides an OpenAPI spec file and wants to know test coverage status.
Generate accessibility tests for WCAG 2.2 compliance using axe-core, Pa11y, and Lighthouse with automated checks for ARIA patterns, keyboard navigation, color contrast, and screen reader support.
Manage and formalize API contracts from existing endpoints, swagger/JSON, network traffic, or developer interviews into OpenAPI specifications.
Autonomously explore live web applications using Playwright MCP to collect page structure, form fields, validation rules, API endpoints, and user flows for test case generation.
| name | qa-httpx-writer |
| description | Generate httpx/requests API tests for Python with async support, session management, and schema validation using pytest. |
| output_dir | tests/api |
| dependencies | {"recommended":["qa-api-contract-curator"]} |
Write Python API tests using httpx (or requests) from test case specifications and API contracts. Transform structured test cases (from qa-testcase-from-docs, qa-manual-test-designer) and OpenAPI contracts (from qa-api-contract-curator) into executable pytest API tests with async support, session management, response schema validation, and authentication handling.
| Feature | Description |
|---|---|
| Async support | httpx.AsyncClient for async tests; httpx.Client for sync |
| Session management | Connection pooling, cookie persistence, header reuse |
| Response validation | Pydantic models, JSON Schema for contract compliance |
| Authentication | Bearer token, API key, OAuth2, Basic Auth, cookies |
| Retry logic | Configurable retries for transient failures |
| Context managers | with httpx.Client() / async with httpx.AsyncClient() |
test_{resource}_api.py with test functions per endpointconftest.py with base_url, client fixtures (sync/async)Use Context7 MCP for httpx documentation when:
| Pattern | Usage |
|---|---|
httpx.Client() | Sync client; use as context manager |
httpx.AsyncClient() | Async client; use with async with |
response.status_code | Assert HTTP status |
response.json() | Parse JSON body |
response.headers | Access response headers |
client.get(url) / client.post(url) | HTTP methods |
client.get(url, headers=...) | Custom headers (auth, etc.) |
| Pydantic validation | Model.model_validate(response.json()) |
| pytest fixtures | base_url, client, async_client in conftest |
See references/patterns.md for CRUD, auth, file upload, streaming, async.
base_url, client (sync), async_client (async) fixturesclass TestUsersAPI: with def test_* methods| Type | Usage |
|---|---|
| Bearer token | headers={"Authorization": f"Bearer {token}"} |
| API key | headers={"X-API-Key": api_key} or params={"api_key": key} |
| OAuth2 | httpx.OAuth2Client or manual token in headers |
| Basic Auth | auth=httpx.BasicAuth(user, password) |
| Cookies | Session cookies via client.cookies or headers={"Cookie": ...} |
test_{resource}_api.py — e.g., test_users_api.py, test_products_api.pytests/ or tests/api/ per project conventionCan do (autonomous):
Cannot do (requires confirmation):
Will not do (out of scope):
pytest)references/patterns.md — CRUD, auth, file upload, streaming, asyncreferences/assertions.md — Status codes, JSON body, headers, Pydantic/JSON Schema validationreferences/config.md — conftest.py, fixtures, environment config, base URLreferences/best-practices.md — Async vs sync, session reuse, schema validation, test isolationtest_{resource}_api.py| Symptom | Likely Cause | Fix |
|---|---|---|
| Connection refused | Wrong base_url or server not running | Verify base_url in conftest; ensure API is up |
| Tests pass individually, fail together | Shared client state or connection pool | Use function-scoped client fixture; avoid session reuse across tests |
response.json() fails | Non-JSON response (204, HTML error) | Check response.status_code; use response.text for non-JSON |
| Async tests fail | Missing pytest-asyncio | Add @pytest.mark.asyncio; install pytest-asyncio; set asyncio_mode = "auto" |
| Auth not working | Token expired or wrong header | Check Authorization format; ensure token in scope |
| Pydantic validation error | Response shape differs from model | Align model with API contract; use model_validate with strict=False if needed |
| Timeout errors | Slow API or network | Increase timeout in client; add retry for transient failures |