一键导入
qa-locust-writer
Generate Locust performance tests in Python for load testing with distributed mode, custom load shapes, and real-time web UI monitoring.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate Locust performance tests in Python for load testing with distributed mode, custom load shapes, and real-time web UI monitoring.
用 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-locust-writer |
| description | Generate Locust performance tests in Python for load testing with distributed mode, custom load shapes, and real-time web UI monitoring. |
| output_dir | tests/performance |
Write Locust performance tests from test case specifications and performance plans. Transform structured test cases (from qa-testcase-from-docs, qa-manual-test-designer) and performance plans (from qa-plan-creator, qa-nfr-analyst) into executable Locust load tests with distributed mode, custom load shapes, real-time web UI, and event hooks.
| Feature | Description |
|---|---|
| HttpUser class | Base class for HTTP-based load; self.client for requests |
| TaskSets | Group related tasks; nest for complex flows |
| @task decorator | Define user behaviors with optional weight |
| wait_time | between, constant, constant_pacing for think time |
| Custom load shapes | LoadTestShape for ramp, spike, soak, custom profiles |
| Event hooks | events.request, events.init, events.test_start/stop |
| Distributed mode | Master/worker for scaling across machines |
| Real-time web UI | Built-in dashboard at http://localhost:8089 |
| Type | Description | Use Case |
|---|---|---|
| Load | Steady load to verify baseline capacity | Baseline, capacity planning |
| Stress | Increase load until failure | Find breaking point |
| Spike | Sudden burst of traffic | Black Friday, flash sales |
| Soak | Sustained load over hours | Memory leaks, stability |
| Custom shapes | User-defined profile via LoadTestShape | Complex scenarios |
HttpUser subclasses per user type (e.g., ApiUser, WebUser)@task(weight=N) for probability distributionlocustfile.py with user classes, tasks, wait_timelocust.conf or CLI args; document distributed setupUse Context7 MCP for Locust documentation when:
| Pattern | Usage |
|---|---|
class MyUser(HttpUser) | Define user class; inherits self.client |
@task / @task(weight=3) | Task method; weight = relative probability |
wait_time = between(1, 3) | Random wait between tasks (seconds) |
wait_time = constant(2) | Fixed wait |
wait_time = constant_pacing(1) | Maintain ~1 req/sec per user |
self.client.get(url) / self.client.post(url) | HTTP requests |
on_start / on_stop | Setup/teardown per user instance |
LoadTestShape | Custom load profile; override tick() |
events.request.add_listener | Request-level hooks (success/failure) |
See references/patterns.md for user classes, task sets, load shapes, events, distributed.
| Role | Command | Purpose |
|---|---|---|
| Master | locust -f locustfile.py --master | Coordinates workers, aggregates stats |
| Worker | locust -f locustfile.py --worker --master-host=<master-ip> | Runs load |
| Expect workers | --expect-workers=4 | Master waits for N workers before starting |
--host, --users, --spawn-rate, --run-time, --headlessLOCUST_HOST, LOCUST_USERS, etc.See references/config.md for full configuration guide.
locustfile.py — Default; or locustfile_{service}.py for multiple fileslocust.conf — Optional configurationtests/load/ or project root per conventionCan do (autonomous):
Cannot do (requires confirmation):
Will not do (out of scope):
locust)references/patterns.md — User classes, task sets, load shapes, events, distributedreferences/config.md — CLI, locust.conf, environment variables, distributed setupreferences/best-practices.md — Realistic scenarios, correlation, custom shapes, CI integration| Symptom | Likely Cause | Fix |
|---|---|---|
| Connection refused | Wrong host or service down | Verify --host; ensure target is reachable |
| Low RPS despite many users | wait_time too high or blocking | Reduce wait_time; avoid sync I/O in tasks |
| Workers not connecting | Firewall, wrong master host | Check --master-host; open port 5557 |
| Memory growth in soak test | Leaks in app or test code | Profile app; avoid accumulating state in tasks |
| Inconsistent results | Shared state, non-determinism | Use per-user state; avoid global variables |
| Task distribution wrong | Incorrect weights | Verify @task(weight=N) sums; check task selection |
| Load shape not applied | LoadTestShape not used | Pass --class-picker or ensure shape in locustfile |