Create a JMeter test plan to performance test a REST API.
- Create Thread Groups with appropriate settings
- Configure HTTP Request samplers
- Add assertions for validation
- Use listeners to analyze results
- JMeter installed (5.x recommended)
- Java 8+ installed
- Download from https://jmeter.apache.org/download_jmeter.cgi
- Extract to a folder
- Run JMeter:
- Windows:
bin\jmeter.bat - Mac/Linux:
./bin/jmeter
- Windows:
- File → New
- Rename Test Plan to "API Performance Test"
Configure:
- Number of Threads (users): 10
- Ramp-Up Period: 5 seconds
- Loop Count: 3
Add → Config Element → HTTP Request Defaults
- Server Name:
httpbin.org - Protocol:
https
Create 3 HTTP Request samplers:
Request 1: GET Request
- Name: GET /get
- Method: GET
- Path: /get
Request 2: POST Request
- Name: POST /post
- Method: POST
- Path: /post
- Body Data:
{"test": "data"} - Add Header Manager:
Content-Type: application/json
Request 3: Delayed Request
- Name: GET /delay/1
- Method: GET
- Path: /delay/1
For each request, add:
- Response Assertion → Response Code = 200
Add the following listeners:
- View Results Tree
- Summary Report
- Aggregate Report
- Save the test plan
- Click the green Play button
- Observe results in listeners
Answer these questions:
- What was the average response time?
- What was the throughput (requests/second)?
- Did any requests fail?
- Which endpoint was slowest?
- JMeter test plan file (
.jmx) - Screenshot of Summary Report
- Answers to analysis questions
- Add a Constant Timer (500ms) between requests
- Increase threads to 50 and observe behavior
- Export results to CSV