Basics of Jmeter which every tester and developer should know
Posted By : Rajat Maan | 25-May-2022
Requirements
1. Apache Jmeter - https://jmeter.apache.org/download_jmeter.cgi > Binaries>
1.1. Linux choose(apache-jmeter-5.4.3.tgz)
1.2. Windows choose(apache-jmeter-5.4.3.zip)
Note: Java version should be above 8+
2. Java – Steps to download from terminal
a. sudo apt update
b. sudo apt install default-jdk
3. Now go to folder of apache jmeter> bin > open jmeter.bat file
For linux Go to bin directory > write ./jmeter.sh in terminal
Jmeter Basics
1. Test plan - Consist of all actions and components you need to execute your performance test script.
Cannot perform multiple projects like eclipse
2. Thread group - A thread group is a set of threads/users executing the same scenario.
3. No of thread = 50 users need to hit the server(bascially putting load on a script)
4. Ramp up period = In how many seconds you want all the users on the server if it is 5 sec means 50/5=10 users hits on the server in one second, in 2nd second 10 users again hit the server and in same way for others.
5. Loop count = To repeat the flow for 5 times means 50 users hit server in 5 seconds 5 times = 50 users x 5 time = 250 times this operation will perform on this server.
Forever = Means the loop keep on running forever. To stop we use scheduler=60 seconds(in 6th loop the server stops)
6. Add the Http requests in thread group
How to check the results of Http requests-
1. Listners - It listens to your executions and presents test result. Like how your test is performing with various performance matrix and how does the result look like.
1.1. View result tree - Green - passed, Red- Failed
Response code - 200(will tell whether test result is pass or failed)
1.2. Aggregate report -
-
Samples - no of users hit the particular http request
-
Average - Average time of all sample request to hit on the server
-
Minimum - Minimum time taken by the user to get a response(one request got response in this minimum time)
-
Maximum - Maximum time taken by the user to get a response(one request got response in this maximum time
-
Error% - What is the failed percentage when no of sample request hit the server.
-
ThroughPut - ex- 56.5/sec means server is able to handle 56.5 request in one second
-
It shows the capability of our server that how many request it can handle in one second.
-
Higher Throughput is better.
-
If our thread count is 100, so we can say that our throughput is 56.5 request/sec for “x” http request.
-
-
90%line - 90% of the user out of samples have not taken more than “x”ms to get the response
-
95%line - 95% of the user out of samples have not taken more than “x”ms to get the response
-
99%line - 99% of the user out of samples have not taken more than “x”ms to get the response
-
Median is not considered if we are considering Average
Non-GUI mode-
It gives the accurate results as Jmeter takes more memory of our system to perform the tests
Steps:-
-
Open cmd/terminal in administrator mode
-
Navigate to bin directory in apache folder by using cd
-
Save all your jmx file in bin folder with .jmx extension
-
Write (jmeter -n) = -n tells to run tests without opening jmeter means it is running in NonGUI mode.
-
Then write (-t Name of file.jmx)= means -t stands for test plan which we are executing.
-
To see the result we add another parameter.
-
Write(-l C:\Results.csv) where -l stands for result file and .csv is the extension of the result file.
-
-e -o stands for expected output where we want to see our expected output.
A example command to generate HTML dashboard report-
./jmeter.sh -n -t "/home/rajat/Downloads/apache-jmeter-5.4.1/bin/candidate1.jmx" -l "/home/rajat/Downloads/apache-jmeter-5.4.1/bin/examples/result.csv" -e -o "/home/rajat/Downloads/apache-jmeter-5.4.1/bin/repo/"
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
Rajat Maan
Rajat is a self-motivated, hard-working person and always ready to face new challenges. He has a good knowledge of Manual Testing techniques and Automation Frameworks.