When testing most of today's modern web applications, an often-encountered response from the server is a JSON payload. JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read/write, and also easy for machines to generate and parse. Due to this ease and its language neutrality, a lot of interchange with servers and services is carried out in this format.
In this recipe, we will cover how to use JMeter to extract information from JSON responses while consuming a freely available weather service. Perform the following steps:
Launch JMeter.
Add Thread Group to the new test plan by navigating to Test Plan | Add | Threads (Users) | Thread Group.
Add the HTTP Request sampler by navigating to Thread Group | Add | Sampler | HTTP Request.
Fill in its attributes in the following way:
Server Name or IP:
api.openweathermap.org
Method:
GET
Path:
/data/2.5/weather
Add the following request parameters to the request by...