.cursor/skills/qa-locust-writer/SKILL.md
Generate Locust performance tests in Python for load testing with distributed mode, custom load shapes, and real-time web UI monitoring.
npx skillsauth add AZANIR/qa-skills qa-locust-writerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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 |
tools
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.
testing
Universal QA plan generator supporting 10 plan types including test plans, sprint plans, regression plans, release plans, UAT plans, performance plans, migration plans, onboarding plans, and custom plans.
development
Generate consumer-driven contract tests using Pact for JavaScript and Python to verify microservice API compatibility between consumer and provider.
development
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.