API Keys
First off, we’ll need an API Key from the Open Weather API.
You can quickly get a free Open Weather API key by creating a basic account on their signup page.
Break the API
Examples of API calls:
api.openweathermap.org/data/2.5/weather?q=London,uk&appid=xxxxxxxxxxx
Protocol-http
IP———api.openweathermap.org
Path-——/data/2.5/weather # this is before Question mark
parameters-
q=suzhou
appid=4e0f6be15c95005cfa5820249166033a
Create Http Request in Jmeter
Add a Listener
Before running we need to add a listener.Listener would show the request and the respense.
Right click on the TestPlan > Select Listener > Add Results in a Tree Listener
run the plan
green means that you have got a success.
So here you see the request made was-
GET
http://api.openweathermap.org/data/2.5/weather?q=suzhou&appid=4e0f6be15c95005cfa5820249166033a
Respons
Put an assertion
in the respense you need to get type=1 for this test case to pass.
Right click on the Test plan and from the assertion list select Response Assertion.
From the response select - “type”:1 and add this to the response assertion.
Now run the test plan again.
You can also add an assertion listener to see the assertion results.then run it again.