Create a JMeter Test Plan with AI
Returns a JMeter test plan as a valid .jmx-shaped XML skeleton with thread groups per scenario type, HTTP request samplers, response assertions, timers, and CSV-driven data: ready to import into JMeter 5.x for refinement and distributed runs.
When to use it
- Adding endpoints to an existing JMeter-based load suite.
- Standardizing JMeter plan structure across teams that share scripts.
- Migrating from GUI-built JMeter plans to maintainable, code-reviewable plans.
- You work in an enterprise environment where JMeter is the standard (banking, telecom).
The prompt
<role>You are a JMeter veteran. You produce .jmx files that import cleanly, follow the standard structure (Test Plan → Thread Group → HTTP Request → Response Assertion + Timer + Listener), and externalize data via CSV Data Set Config.</role> <context>JMeter 5.x is the target version. Plans use Thread Groups as scenarios. Each Thread Group has: HTTP Request Defaults, HTTP samplers, a Response Assertion per sampler, a constant or Gaussian timer for think time, and a backend listener (InfluxDB / Prometheus). Test data lives in CSV files loaded via CSV Data Set Config: never inline.</context> <task>For the endpoint(s) below, produce:1. A complete .jmx XML structure (top-level TestPlan with one ThreadGroup per scenario type)2. HTTP Request Defaults for shared configuration3. HTTP Request samplers per endpoint4. Response Assertion per sampler (status + payload sanity)5. A timer (Gaussian random) per thread group6. CSV Data Set Config for test data7. Backend Listener pointed at InfluxDB or Prometheus</task> <input>Endpoint(s) (method, URL, payload): {endpoints}Scenarios needed (steady, ramp, spike, etc.): {scenarios}Target concurrent users / RPS: {target}SLA: {sla}</input> <constraints>- Output must be VALID .jmx structure: proper XML with hashTree elements.- Externalize test data via CSV Data Set Config: never inline data.- One thread group per scenario type, not one per endpoint.- Response Assertion on every sampler (don't ship without).- Timer present per thread group (without it, JMeter goes full throttle = unrealistic).- Several thread groups run in parallel by default: set "Run Thread Groups consecutively" (`TestPlan.serialize_threadgroups`) when scenarios must run one after another.- Values meant to be overridden with `-J` are read with `${__P(name,default)}`: `-J` sets properties, not User Defined Variables.- JSON bodies need an HTTP Header Manager with `Content-Type: application/json`.</constraints> <output_format>Four sections:1. **Plan structure (overview)**: text outline of the .jmx tree2. **.jmx code block**: XML snippet (truncated if very long, but core structure complete)3. **CSV data file**: sample data.csv content4. **Notes**: how to wire backend listener and run distributed</output_format> <approach>Before writing, decide thread-group structure based on the scenarios (one per scenario, not per endpoint).</approach>## RoleJMeter veteran. .jmx files that import cleanly. Standard structure: TestPlan → ThreadGroup → HTTPRequest + Assertion + Timer + Listener. Data via CSV. ## ContextJMeter 5.x. Thread Groups = scenarios. Each has: HTTP Defaults, samplers, Response Assertions, timer, backend listener. Test data in CSV. ## TaskProduce:1. Valid .jmx structure (TestPlan + one ThreadGroup per scenario type)2. HTTP Request Defaults3. Samplers per endpoint4. Response Assertion per sampler5. Gaussian random timer per thread group6. CSV Data Set Config7. Backend Listener (InfluxDB or Prometheus) ## Input- Endpoints: {endpoints}- Scenarios: {scenarios}- Target users/RPS: {target}- SLA: {sla} ## Constraints- Valid .jmx XML with hashTree elements.- CSV for data, never inline.- One thread group per scenario type, not per endpoint.- Response Assertion mandatory per sampler.- Timer mandatory per thread group.- Thread groups run in parallel unless `TestPlan.serialize_threadgroups` is true.- `-J` overrides need `${__P(name,default)}` in the plan.- HTTP Header Manager with Content-Type: application/json for JSON bodies. ## Output format4 sections: Plan structure overview | .jmx code block | CSV sample | Notes on backend listener + distributed runs. ## ApproachDecide thread-group structure per scenario, not per endpoint.Example
Input
Endpoints:
- POST /api/login (body: { username, password }, expects 200 with token)
- GET /api/profile (Bearer token required, expects 200)
- PUT /api/profile (Bearer token, body: { displayName }, expects 200)
Scenarios needed: Load (200 concurrent users for 20 min), Stress (ramp from 100 to 1000 over 15 min)
Target: 200 concurrent users sustained
SLA: p95 < 1500ms, error rate < 1%Output
## Plan structure (overview)
```
Test Plan: "User Profile Load Test"
├── Test Plan setting: Run Thread Groups consecutively (Load first, then Stress)
├── User Defined Variables (BASE_URL = ${__P(BASE_URL,api.staging.example.com)})
├── HTTP Request Defaults (host, port, protocol)
├── HTTP Header Manager (Content-Type, Accept)
├── CSV Data Set Config (users.csv → variables: username, password)
├── Thread Group: "Load: 200 concurrent users for 20 min"
│ ├── HTTP Request: POST /api/login → extract token
│ │ └── JSON Extractor: $.token → ${AUTH_TOKEN}
│ │ └── Response Assertion: status=200, payload contains "token"
│ ├── Gaussian Random Timer (mean=2000ms, deviation=500ms)
│ ├── HTTP Request: GET /api/profile (header: Authorization: Bearer ${AUTH_TOKEN})
│ │ └── Response Assertion: status=200
│ ├── Gaussian Random Timer
│ └── HTTP Request: PUT /api/profile
│ └── Response Assertion: status=200
├── Concurrency Thread Group (JMeter Plugins): "Stress: ramp 100→1000 over 15 min"
│ └── (same samplers as Load thread group)
├── Backend Listener: InfluxDB (url=http://influxdb:8086, application=user-profile-test)
└── View Results Tree (disabled in CI, enabled for local debugging)
```
## .jmx code block
```xml
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="User Profile Load Test">
<stringProp name="TestPlan.user_define_classpath"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments">
<collectionProp name="Arguments.arguments">
<elementProp name="BASE_URL" elementType="Argument">
<stringProp name="Argument.name">BASE_URL</stringProp>
<stringProp name="Argument.value">${__P(BASE_URL,api.staging.example.com)}</stringProp>
</elementProp>
</collectionProp>
</elementProp>
</TestPlan>
<hashTree>
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults">
<stringProp name="HTTPSampler.domain">${BASE_URL}</stringProp>
<stringProp name="HTTPSampler.port">443</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
</ConfigTestElement>
<hashTree/>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager">
<collectionProp name="HeaderManager.headers">
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Content-Type</stringProp>
<stringProp name="Header.value">application/json</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree/>
<CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="users.csv">
<stringProp name="filename">users.csv</stringProp>
<stringProp name="variableNames">username,password</stringProp>
<stringProp name="delimiter">,</stringProp>
<boolProp name="recycle">true</boolProp>
<stringProp name="shareMode">shareMode.all</stringProp>
</CSVDataSet>
<hashTree/>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Load: 200 concurrent for 20m">
<stringProp name="ThreadGroup.num_threads">200</stringProp>
<stringProp name="ThreadGroup.ramp_time">120</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<stringProp name="ThreadGroup.duration">1200</stringProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POST /api/login">
<stringProp name="HTTPSampler.path">/api/login</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<stringProp name="Argument.value">{"username":"${username}","password":"${password}"}</stringProp>
</elementProp>
</collectionProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion">
<collectionProp name="Asserion.test_strings">
<stringProp>200</stringProp>
</collectionProp>
<stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
<intProp name="Assertion.test_type">8</intProp>
</ResponseAssertion>
<JSONPostProcessor guiclass="JSONPostProcessorGui" testclass="JSONPostProcessor" testname="Extract token">
<stringProp name="JSONPostProcessor.referenceNames">AUTH_TOKEN</stringProp>
<stringProp name="JSONPostProcessor.jsonPathExprs">$.token</stringProp>
</JSONPostProcessor>
</hashTree>
<GaussianRandomTimer guiclass="GaussianRandomTimerGui" testclass="GaussianRandomTimer">
<stringProp name="ConstantTimer.delay">2000</stringProp>
<stringProp name="RandomTimer.range">500</stringProp>
</GaussianRandomTimer>
<hashTree/>
<!-- additional samplers (GET /api/profile, PUT /api/profile) follow the same pattern -->
</hashTree>
<!-- Stress thread group (Concurrency Thread Group from JMeter Plugins) follows the same pattern -->
<BackendListener guiclass="BackendListenerGui" testclass="BackendListener" testname="InfluxDB">
<stringProp name="classname">org.apache.jmeter.visualizers.backend.influxdb.InfluxdbBackendListenerClient</stringProp>
</BackendListener>
<hashTree/>
</hashTree>
</hashTree>
</jmeterTestPlan>
```
## CSV data file (`users.csv`)
```
username,password
loadtest_user001,Pass1234
loadtest_user002,Pass1234
loadtest_user003,Pass1234
```
## Notes
- Wire backend listener to a running InfluxDB instance with the JMeter influxdb plugin; results appear in Grafana via the InfluxDB datasource.
- For distributed runs: start `jmeter-server` on each load generator, list them in `remote_hosts` in jmeter.properties, run with `jmeter -n -r -t plan.jmx -l results.jtl`. Copy users.csv to every generator.
- Run in CLI mode (`-n`) for actual load tests; GUI mode is for editing only and skews results.
- Override environment-specific values at run time with `-JBASE_URL=api.prod-like.example.com`; the plan reads them through `${__P(BASE_URL,...)}`. The stress group needs the free Custom Thread Groups plugin (Plugins Manager).Common pitfalls
- Model produces pseudo-XML that won't import; demand 'valid .jmx XML with hashTree elements'.
- Test data goes inline into the sampler body instead of CSV: fine for 5 users, broken at 500.
- Timer omitted; results show unrealistically high throughput because JMeter goes flat-out.
- Response Assertion only checks 200: no payload sanity. Adds risk of 'green' tests that didn't actually work.
Tips
- Always run in CLI mode (`-n`) for actual measurements. GUI mode adds ~30% overhead and skews results.
- Externalize URL, ramp, duration: read them with `${__P(name,default)}` in the plan and pass `-Jname=value` at run time. Same plan, multiple environments.
- Give every element a unique, descriptive testname before committing the .jmx: raw XML diffs are hard to review otherwise.
- Pair with `design-load-test-strategy` to ensure thread group structure matches strategy.
FAQ
JMeter vs k6 in 2026?
JMeter dominates enterprise (banking, telecom) where institutional knowledge runs deep. k6 dominates new projects and code-first teams. Either is capable; choose based on team familiarity and CI integration costs.
GUI vs non-GUI runs?
GUI is for editing only. Always run measurements in non-GUI (`-n`). GUI adds significant overhead and reduces throughput.
Distributed JMeter: when needed?
When a single JMeter instance can't generate target load (~1000+ concurrent users on a typical box). Below that, single-instance is simpler. Above, set up one controller and several remote load generators.
Why is my JMeter throughput lower than expected?
Most common: GUI mode (not -n), View Results Tree enabled (logs every sample to memory), or test client is the bottleneck (insufficient CPU on the JMeter host). Always profile the test client first.