How to install APACHE JMeter and hit HTTP API in JMeter?
Install JMeter using Brew
I will install the Jmeter in the mac OS by using the brew command. If the brew is not installed on the mac then it can be installed using the curl command. For reference pls find the link below
Install Brew on MAC
After Installing brew, go to the terminal, type the below command
brew install jmeter
To check the JMeter Version, type the below command
jmeter --version
The JMeter will be installed in the homebrew directory and now we have to run the script file for the same
#Go To Directory Path
cd /opt/homebrew/Cellar/jmeter/5.5/bin
#Run the script file
sh jmeter
The above script will launch the JMeter Application
After launching the JMeter Application, now we need to run the HTTP/HTTPS request, but for that, we need to create the plan, we can choose any name by default its “Test Plan”. After that, we will add the thread and select the thread group
After selecting the above, It asks to name the thread group and also its properties
- No of Threads(Users) by default its 1 means how many users are using that request
- Ramp-Up Period (in seconds) — the difference between the threads
- Loop Count — total number of hits hit by the user
Now we will add the HTTP Request in the thread which we just created
After selecting the HTTP request it will ask for some properties of the request like URL, parameters, etc.
In the above firstly we define the protocol and then the server/ip and if any port number we’re using then we can mention that and then select the HTTP method.
Consider we have the following URL-
URL https://imvikaskohli.medium.com/my-stories?page=1
Protocol - https
Server - imvikaskohli.medium.com
Path - /my-stories
Http Method - Get
Parameters - page is the key with value 1
It can happen that we need to add the HTTP header too like for authorization or something else to send the HTTP request. For that, we need to add that as well. Click on the HTTP request that we just added, go to Config Element, and then select the HTTP Header Manager
After that, we can add the header parameters that will be sent along with the HTTP request.
Also, we need to see results for that we’ll attach a listener to it and if we need the total summary we can add that too.
Click on the thread that we created then go to the listener and then select the View Result Tree
For Summary, select the summary report
After that click on the save button or Cmd + S to save. To run click on the first green color button it will run the thread
After the run we can view the results in the View Result Tree and Their summary inside the Summary Report
Hope this helps in running the HTTP Request in the JMeter
Increase the iterations for load Testing
Happy Testing 😊