Representational State Transfer (REST) Uses HTTP Protocol and can be used to access the resources using Uniform Resource Identifier (URI).
JMeter Test Plan Creation
- Adding ‘Test Plan’ element: Create the test plan and rename it to ‘REST API Performance Test’, as shown below.
- Adding ‘Thread Group’ element: You can configure ‘Thread Group’ as per your requirement and simulate concurrent virtual users and time for the load test.
- Add ‘HTTP Header Manager’ Config Element: This overrides the HTTP request header and decides the header content in the request. You need to add the following content-type:
Content-Type: application/json;charset=UTF-8
- Add ‘HTTP Request Defaults’ Config element: Need to configure domain name or IP address and must not include the http://prefix.
- Add ‘HTTP Request’ Sampler Element: Go to the ‘Add’ menu and select Sampler->HTTP Request. Configure REST API ‘Path’ and JSON request in ‘Body Data’ and ‘Method’ given below.
- Add ‘CSV Data Set Config’ element: Jmeter uses CSV data dynamically for storing multiple data objects, update data values, and more.
- Add ’Response Assertion’ element: This is used to verify the REST API Response.
- Add ‘ View Result Tree’ and ‘Aggregated Report’ Listener element: The Listener element stores all results of your HTTP requests in a file and aggregated report is used to analyze the test result.
- Add ‘jp@gc-Response Times over Time’ Listener element: The graph shown below highlights the response time during the load time.
- Run the test plan and view output.
You may also like: How to Perform Distributed Testing Using JMeter?