How multiple Users can hit multiple APIs through JMeter
Posted By : Aditi Nahar | 03-Jan-2018
The Simple Test plan of JMeter is that one user is hitting only one API/request. But in the real scenario, multiple users will always be there who will hit either single api or multiple apis. This can be understood by a simple example that a live application will be used by many users simultaneously and also multiple requests can be send by the same user on that application. Thus checking the application with this test scenario is very important. In JMeter we can create multiple users and multiple requests and also the combination of both of them.
Let's understand this with examples:
Test Scenario 1: Single User hitting multiple (3) http apis.
Step 1: Create a simple Test Plan with 1 Thread group and add three simple controllers under it i.e With text template, With html template and Without template. Right click Thread Group > Add > Logic Controller > Simple Controller
Step 2: Add http request sampler under each controller and fill the required fields. Right click controller > Add > Sampler > HTTP Request
Step 3: To view the results add a Listener 'View Results in Table' and check the result. Right click Thread Group > Add > Listener > View Results in Table
Now check the result. It shows a single user hits 3 different http apis successfully.
Test Scenario 2: Multiple users (5) hitting multiple (5) http apis.
Step 1: Create a Test Plan with 5 Thread groups. In each of the Thread groups keep the same configuration as Number of Threads -1 ; Ramp Up period - 1 and Loop Count - 1
Step 2 : Now under each thread group add http request sampler and fill the fields. Right click Thread Group > Add > Sampler > HTTP Request
Step 3 : To view the results add a Listener 'View Results in Table' and check the result. Right click Test Plan > Add > Listener > View Results in Table
Now check the result. It shows 5 users hits 5 different http apis successfully.
Thanks!!
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Aditi Nahar
Aditi is a certified QA Engineer with a strong command over management tool sets like JIRA and Trello, as well as QA tool sets for API and performance testing. She possesses excellent verbal and written communication skills and has gained valuable experience in management and leadership while collaborating with clients and large teams. Aditi's ability to apply creative thinking and problem-solving skills makes her adept at handling challenging business scenarios. Her proficiency in manual testing has proven instrumental in identifying issues and ensuring the functionality of applications across web, mobile, and TV platforms. She has made significant contributions to both internal and client projects, including Bits2Btc, AUS-BTC, EZBitex, ACL EAP, Scaffold, Iron Systems VRP, Oremus Zoho, and NOWCAST OTT.