QA JMeter Writer
Purpose
Write JMeter test plans (.jmx) from performance test specifications. Transform structured performance requirements (from qa-plan-creator performance plans, qa-nfr-analyst NFR specs) into executable JMeter XML test plans with thread groups, samplers, listeners, assertions, and CI-ready configuration.
Trigger Phrases
- "Write JMeter tests for [API/endpoint]"
- "Generate JMeter load tests from performance plan"
- "Create JMeter .jmx for [service]"
- "JMeter thread group with HTTP samplers"
- "JMeter test plan with assertions and listeners"
- "JMeter CSV data parameterization"
- "JMeter CI integration non-GUI mode"
- "JMeter distributed load test plan"
- "JMeter JSON assertion for API"
- "JMeter JSR223 Groovy preprocessor"
Key Features
| Feature |
Description |
| Thread Groups |
Users, ramp-up, loops, duration for load modeling |
| HTTP Request Sampler |
URL, method, body, headers, path |
| JDBC/JMS Samplers |
Database and messaging protocol support |
| Listeners |
Aggregate Report, Summary Report, Graph Results, View Results Tree |
| Assertions |
Response Assertion, Duration Assertion, Size Assertion, JSON Assertion |
| CSV Data Set Config |
Parameterization from CSV files |
| Extractors |
Regular Expression Extractor, JSON Extractor |
| Timers |
Constant, Uniform Random, Gaussian for think time |
| Pre/Post Processors |
JSR223 (Groovy), BeanShell for correlation |
Workflow
- Read performance plan — From qa-plan-creator (performance plan) or qa-nfr-analyst (NFR specs)
- Design thread groups — Map load profiles to Thread Group (users, ramp-up, loops, duration)
- Add samplers — HTTP Request, JDBC, JMS as needed
- Configure assertions — Response, Duration, Size, JSON for validation
- Add listeners — Aggregate Report, Summary Report for results
- Generate .jmx — Produce valid JMeter XML test plan file
Key Patterns
| Pattern |
Usage |
| Thread Group |
num_threads, ramp_time, loops, duration for load modeling |
| HTTP Request |
Domain, path, method, body, headers |
| Response Assertion |
Status code, response text, response code |
| Duration Assertion |
Max response time (ms) |
| JSON Assertion |
JSONPath, expected value |
| CSV Data Set Config |
Filename, variable names, delimiter |
| Regular Expression Extractor |
Regex, template, match number, variable |
| JSR223 PreProcessor |
Groovy script for correlation |
Thread Group Example
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Load Users" enabled="true">
<stringProp name="ThreadGroup.num_threads">50</stringProp>
<stringProp name="ThreadGroup.ramp_time">60</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController">
<stringProp name="LoopController.loops">-1</stringProp>
<stringProp name="ThreadGroup.duration">300</stringProp>
</elementProp>
</ThreadGroup>
HTTP Request Sampler
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="GET /api/users" enabled="true">
<stringProp name="HTTPSampler.domain">api.example.com</stringProp>
<stringProp name="HTTPSampler.path">/api/users</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
</HTTPSamplerProxy>
Response Assertion
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Status 200" enabled="true">
<collectionProp name="Assertion.test_strings">
<stringProp name="49586">200</stringProp>
</collectionProp>
<stringProp name="Assertion.custom_message"></stringProp>
<stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
</ResponseAssertion>
See references/patterns.md for thread groups, samplers, assertions, extractors, timers, controllers.
Output
- JMeter test plans —
.jmx files in tests/, performance/, or jmeter/ per project convention
- Run via CLI —
jmeter -n -t test.jmx -l results.jtl -e -o report/
- CI integration — Non-GUI mode (
-n), JTL results (-l), HTML report (-e -o)
CI Integration
| Option |
Description |
-n |
Non-GUI mode (headless) |
-t test.jmx |
Test plan file |
-l results.jtl |
Results file (JTL/CSV) |
-e |
Generate HTML report after run |
-o report/ |
Output directory for HTML report |
-Jprop=value |
Override JMeter properties |
Scope
Can do (autonomous):
- Generate .jmx test plans from performance plans and NFR specs
- Design thread groups (users, ramp-up, loops, duration)
- Add HTTP, JDBC, JMS samplers with proper configuration
- Configure Response, Duration, Size, JSON assertions
- Add CSV Data Set Config for parameterization
- Add Regular Expression Extractor, JSON Extractor for correlation
- Add timers (Constant, Uniform Random) for think time
- Add JSR223 PreProcessor (Groovy) for dynamic logic
- Add listeners (Aggregate Report, Summary Report)
- Generate CI-ready run commands
Cannot do (requires confirmation):
- Change production service configuration
- Target production without explicit consent
- Add JMeter plugins not in standard distribution
- Override project JMeter config without approval
Will not do (out of scope):
- Execute tests (user runs
jmeter -n -t test.jmx)
- Write E2E functional tests (use qa-playwright-ts-writer)
- Provision load infrastructure (distributed JMeter setup)
- Modify CI/CD pipelines beyond JMeter integration
References
references/patterns.md — Thread groups, samplers, assertions, extractors, timers, controllers
references/config.md — CLI mode, properties, plugins, distributed testing
references/best-practices.md — Non-GUI mode, parameterization, correlation, result analysis
Quality Checklist
Troubleshooting
| Symptom |
Likely Cause |
Fix |
| OutOfMemoryError in JMeter |
Too many threads or listeners |
Reduce threads; remove View Results Tree; increase JVM heap (-Xmx) |
| Assertions fail in CI |
Different baseline or env |
Align assertion thresholds; use ${__P()} for env-specific values |
| High error rate |
Timeouts, 5xx, or wrong assertions |
Increase timeout; fix assertion logic; verify endpoint |
| CSV not found |
Relative path |
Use absolute path or ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)} |
| Correlation fails |
Extractor order or regex |
Ensure extractor runs before dependent sampler; verify regex |
| JMX invalid XML |
Malformed elements |
Validate XML; ensure proper closing tags; check JMeter version compatibility |
| Slow HTML report |
Large JTL file |
Use Aggregate Report listener; reduce sample logging; filter by label |
1---2name: qa-jmeter-writer3description: Generate JMeter performance test plans in XML/JMX format with thread groups, samplers, listeners, assertions, and CI-ready configuration.4---56# QA JMeter Writer78## Purpose910Write JMeter test plans (.jmx) from performance test specifications. Transform structured performance requirements (from qa-plan-creator performance plans, qa-nfr-analyst NFR specs) into executable JMeter XML test plans with thread groups, samplers, listeners, assertions, and CI-ready configuration.1112## Trigger Phrases1314- "Write JMeter tests for [API/endpoint]"15- "Generate JMeter load tests from performance plan"16- "Create JMeter .jmx for [service]"17- "JMeter thread group with HTTP samplers"18- "JMeter test plan with assertions and listeners"19- "JMeter CSV data parameterization"20- "JMeter CI integration non-GUI mode"21- "JMeter distributed load test plan"22- "JMeter JSON assertion for API"23- "JMeter JSR223 Groovy preprocessor"2425## Key Features2627| Feature | Description |28|---------|-------------|29| **Thread Groups** | Users, ramp-up, loops, duration for load modeling |30| **HTTP Request Sampler** | URL, method, body, headers, path |31| **JDBC/JMS Samplers** | Database and messaging protocol support |32| **Listeners** | Aggregate Report, Summary Report, Graph Results, View Results Tree |33| **Assertions** | Response Assertion, Duration Assertion, Size Assertion, JSON Assertion |34| **CSV Data Set Config** | Parameterization from CSV files |35| **Extractors** | Regular Expression Extractor, JSON Extractor |36| **Timers** | Constant, Uniform Random, Gaussian for think time |37| **Pre/Post Processors** | JSR223 (Groovy), BeanShell for correlation |3839## Workflow40411. **Read performance plan** — From qa-plan-creator (performance plan) or qa-nfr-analyst (NFR specs)422. **Design thread groups** — Map load profiles to Thread Group (users, ramp-up, loops, duration)433. **Add samplers** — HTTP Request, JDBC, JMS as needed444. **Configure assertions** — Response, Duration, Size, JSON for validation455. **Add listeners** — Aggregate Report, Summary Report for results466. **Generate .jmx** — Produce valid JMeter XML test plan file4748## Key Patterns4950| Pattern | Usage |51|---------|-------|52| **Thread Group** | `num_threads`, `ramp_time`, `loops`, `duration` for load modeling |53| **HTTP Request** | Domain, path, method, body, headers |54| **Response Assertion** | Status code, response text, response code |55| **Duration Assertion** | Max response time (ms) |56| **JSON Assertion** | JSONPath, expected value |57| **CSV Data Set Config** | Filename, variable names, delimiter |58| **Regular Expression Extractor** | Regex, template, match number, variable |59| **JSR223 PreProcessor** | Groovy script for correlation |6061### Thread Group Example6263```xml64<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Load Users" enabled="true">65 <stringProp name="ThreadGroup.num_threads">50</stringProp>66 <stringProp name="ThreadGroup.ramp_time">60</stringProp>67 <elementProp name="ThreadGroup.main_controller" elementType="LoopController">68 <stringProp name="LoopController.loops">-1</stringProp>69 <stringProp name="ThreadGroup.duration">300</stringProp>70 </elementProp>71</ThreadGroup>72```7374### HTTP Request Sampler7576```xml77<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="GET /api/users" enabled="true">78 <stringProp name="HTTPSampler.domain">api.example.com</stringProp>79 <stringProp name="HTTPSampler.path">/api/users</stringProp>80 <stringProp name="HTTPSampler.method">GET</stringProp>81 <boolProp name="HTTPSampler.use_keepalive">true</boolProp>82</HTTPSamplerProxy>83```8485### Response Assertion8687```xml88<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Status 200" enabled="true">89 <collectionProp name="Assertion.test_strings">90 <stringProp name="49586">200</stringProp>91 </collectionProp>92 <stringProp name="Assertion.custom_message"></stringProp>93 <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>94 <boolProp name="Assertion.assume_success">false</boolProp>95</ResponseAssertion>96```9798See `references/patterns.md` for thread groups, samplers, assertions, extractors, timers, controllers.99100## Output101102- **JMeter test plans** — `.jmx` files in `tests/`, `performance/`, or `jmeter/` per project convention103- **Run via CLI** — `jmeter -n -t test.jmx -l results.jtl -e -o report/`104- **CI integration** — Non-GUI mode (`-n`), JTL results (`-l`), HTML report (`-e -o`)105106## CI Integration107108| Option | Description |109|--------|-------------|110| `-n` | Non-GUI mode (headless) |111| `-t test.jmx` | Test plan file |112| `-l results.jtl` | Results file (JTL/CSV) |113| `-e` | Generate HTML report after run |114| `-o report/` | Output directory for HTML report |115| `-Jprop=value` | Override JMeter properties |116117## Scope118119**Can do (autonomous):**120- Generate .jmx test plans from performance plans and NFR specs121- Design thread groups (users, ramp-up, loops, duration)122- Add HTTP, JDBC, JMS samplers with proper configuration123- Configure Response, Duration, Size, JSON assertions124- Add CSV Data Set Config for parameterization125- Add Regular Expression Extractor, JSON Extractor for correlation126- Add timers (Constant, Uniform Random) for think time127- Add JSR223 PreProcessor (Groovy) for dynamic logic128- Add listeners (Aggregate Report, Summary Report)129- Generate CI-ready run commands130131**Cannot do (requires confirmation):**132- Change production service configuration133- Target production without explicit consent134- Add JMeter plugins not in standard distribution135- Override project JMeter config without approval136137**Will not do (out of scope):**138- Execute tests (user runs `jmeter -n -t test.jmx`)139- Write E2E functional tests (use qa-playwright-ts-writer)140- Provision load infrastructure (distributed JMeter setup)141- Modify CI/CD pipelines beyond JMeter integration142143## References144145- `references/patterns.md` — Thread groups, samplers, assertions, extractors, timers, controllers146- `references/config.md` — CLI mode, properties, plugins, distributed testing147- `references/best-practices.md` — Non-GUI mode, parameterization, correlation, result analysis148149## Quality Checklist150151- [ ] Thread groups match performance plan load profiles (users, ramp-up, duration)152- [ ] Assertions validate critical responses (status, duration, size)153- [ ] No hardcoded secrets; use `${__P()}` or CSV for credentials154- [ ] Think time (timers) between requests where realistic155- [ ] Listeners suitable for CI (Aggregate Report, Summary Report; avoid View Results Tree in load runs)156- [ ] CSV Data Set Config for parameterization when needed157- [ ] Extractors for correlation when session/token required158- [ ] Test plan runs in non-GUI mode without errors159160## Troubleshooting161162| Symptom | Likely Cause | Fix |163|---------|--------------|-----|164| OutOfMemoryError in JMeter | Too many threads or listeners | Reduce threads; remove View Results Tree; increase JVM heap (`-Xmx`) |165| Assertions fail in CI | Different baseline or env | Align assertion thresholds; use `${__P()}` for env-specific values |166| High error rate | Timeouts, 5xx, or wrong assertions | Increase timeout; fix assertion logic; verify endpoint |167| CSV not found | Relative path | Use absolute path or `${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}` |168| Correlation fails | Extractor order or regex | Ensure extractor runs before dependent sampler; verify regex |169| JMX invalid XML | Malformed elements | Validate XML; ensure proper closing tags; check JMeter version compatibility |170| Slow HTML report | Large JTL file | Use Aggregate Report listener; reduce sample logging; filter by label |