Application Programming Interface provides access to the application without users actually having to interact with a potentially disparate system. This JMeter API Testing article will check if the API meets the expectations for functionality, reliability, performance, and security in the following sequence:
Introduction to API
Application Programming Interface (API) allows one software to interact with another software. It is a messenger that takes a request from one system to another system, provides the requirements and gets the response back to the requesting system.
API acts as a messenger between two systems. For example, when you visit a restaurant, the waiter serves as the middleman who takes your order from the menu and serves it from the kitchen. Here, the waiter is the API which takes the request from system A (Customer). Then, go to system B (Kitchen) and tell system B what system A wants. Finally, it takes the expected response of the request and carries it back to system A.
Real World Example of API
One common example of using APIs in the real world is booking flight tickets. There are numerous websites for booking flight tickets. But they do not belong to any particular airline. To book your flight, you need to interact with the airline’s website to access the airline’s database. How do these websites interact with a particular flight database?
It is possible through APIs. These Flight companies provide APIs to many websites for booking a ticket and for getting the response of the query from these websites. They promote their business, which in turn provide some margin of profit to these website companies.
Now that you know how API works, let’s move ahead and see how API Testing is done in JMeter.
JMeter API Testing | Edureka
This video will provide you in-depth knowledge about client and server communication with an API. It will provide a step by step guide on how to test API for web services.
JMeter API Testing: Demo
Apache JMeter is one of the most popular, open-source software for performance testing. In order to Perform API Testing in JMeter, you have to download and install the tool in your system. If you have any doubts regarding this tool, you can check out the JMeter Tutorial and How to Install JMeter for more knowledge.
Steps to Perform API Testing in JMeter
- Firstly, you have to start your JMeter and select the Test Plan.
- Next, Right click on the Test Plan and add a Thread Group.
- Then you have to add HTTP Request and enter the Server name or IP of your API and set the Path and Parameters. Right click on Thread Group, select Sampler and add HTTP Request.
- Next, you can search for REST APIs that are freely available on the internet. Copy the Server Name, Path, and Parameters for that particular API.
Here, I have taken the example of Weather API for Bangalore.
- Once you have the API, find out the server name, path, and parameters from the link. Copy the values in the HTTP Request of JMeter Test Plan.
- Now, add a Listener to view the results of your Test. Right click on HTTP Request, select Listeners and add View Results Tree or View Results in Table.
- The final step is to just Run your Test Plan. You can increase the number of Threads in order to increase the Load on your API. The Test Result will show the Request and Response for the HTTP Request server. You can see the exact weather values in the Response Data section.
With these steps, you have successfully completed your API Testing. I hope you understood what is API and how you can test your API in JMeter.
Now that you know how to Test API in JMeter, check out the Performance Testing Certification Course by Edureka. This course provides you insights into software behavior during workload. In this course, you will learn how to check the response time and latency of software and test if a software package is efficient for scaling. It will help you check the strength and analyze the overall performance of an application under different load types.
Got a question for us? Please mention it in the comments section of “JMeter API Testing” and we will get back to you.