Basic API testing

 

API testing

 

In the API testing with Jmeter, different APIs with keys are used to get valid response from a webserver and to check performance of webserver under manually created load.

Let us know API testing step by step

 

1.     Open Jmeter and add “Thread Group”. Once it is added, add HTTP request under Thread Group.

2.     In HTTP requests, there are multiple fields to fill. In “Server Name or IP”, enter plain URL without ‘https://’. Next part of URL should be filled in path. Now, in the parameters option, click ‘add’ and add new parameter(s) which is(are) defined in the URL. Also add API key / API-ID if it is in the URL.

For example, the URL http://api.openweathermap.org/data/2.5/weather?q=London&appid=0a263587d3f681731a734dc54ccb3a6c can be segmented into following parts

Servername / IP :- api.openweathermap.org
Path:- /data/2.5/weather?

Paramater name                    Value
q                                              London
APPID                                      0a263587d3f681731a734dc54ccb3a6c

 

3.     Once HTTP request is filled with necessary details, right click on Thread Group and add ‘View Result tree’ from ‘Listener’ sub-menu.

4.     Run test and check result tree for HTTP request. Response code 200 indicates that test and webserver response is successful. Test results from step 2 will display current weather of the London.

5.     We can write desired city name by replacing London with another city from step 2. Running again the same test will display its current weather.

6.     Note that, without valid API key HTTP requests may not work and will give error ‘401’. Sometimes API key may take couple of hours to get activated.

7.     Some API testing may not need API key. They require only parameter (like London in step 2). Without API key, these tests do give results without any errors.
For example,
http://universities.hipolabs.com/search?country=India gives list of universities in a country along with its official website. As you can see, there is no API key mentioned in the URL

  • 0 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

New joinee induction checklist

  Induction checklist of New Joinee                 Name of New...

Requirement Gathering

  Whenever we are discussing with client and understanding their needs, few things...

Setup Tally on Cloud

  Hi, Setting up Tally on Cloud is simple task task. Following are steps to follow 1.     Set...

Gaming - setting up server

  Hi, Setting up windows server for gaming is very crucial step when it come to game renderning....

Gaming - order processing

  Once there is an order placed by user for gaming, it will be notified via email and in WHMCS...

Powered by WHMCompleteSolution