Time to build a real test plan from scratch. This exercise walks you through creating a multi-request test plan that simulates a user flow.
Open JMeter and create a new Test Plan named "API Load Test".
Add a Thread Group: 20 users, 20 second ramp-up, 3 loops.
Add HTTP Request #1: GET https://jsonplaceholder.typicode.com/users (name: "Get Users").
Add HTTP Request #2: GET https://jsonplaceholder.typicode.com/posts?userId=1 (name: "Get User Posts").
Add HTTP Request #3: POST https://jsonplaceholder.typicode.com/posts with body: {"title":"test","body":"performance test","userId":1} (name: "Create Post"). Set Content-Type header to application/json.
Add a Uniform Random Timer under the Thread Group: Delay 2000ms, Random offset 3000ms (total delay: 2-5 seconds between requests).
Add a Response Assertion to each request: verify response code is 200 (or 201 for POST).
Add a Duration Assertion to each request: 3000ms max.
Add Summary Report and View Results Tree listeners.
Save and run in GUI mode first (verify green results). Then run in CLI mode: jmeter -n -t api-load-test.jmx -l results.jtl -e -o report/
Open the HTML report and analyze: what is the p95? What is the throughput? Any errors?
| Request | Expected p95 | Expected Error Rate |
|---|---|---|
| Get Users | < 500ms | 0% |
| Get User Posts | < 500ms | 0% |
| Create Post | < 500ms | 0% (201 status) |
After the basic test works: (1) Increase users to 50 and ramp-up to 10 seconds. Observe how throughput changes. (2) Remove the timer and run again. Notice how throughput jumps dramatically -- this is the effect of think time. (3) Add an HTTP Header Manager under the Thread Group with Accept: application/json. Verify all responses return JSON.
jsonplaceholder.typicode.com is a free public API. Be respectful -- do not run tests with more than 100 users or for extended durations. For serious load testing, set up your own test target or use the Shopping Portal on this platform.
Key Point: Build a multi-request test plan with assertions, timers, and listeners. Run in GUI for debugging, CLI for actual tests.