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 -

  1. Samples - no of users hit the particular http request

  2. Average - Average time of all sample request to hit on the server

  3. Minimum - Minimum time taken by the user to get a response(one request got response in this minimum time)

  4. Maximum - Maximum time taken by the user to get a response(one request got response in this maximum time

  5. Error% - What is the failed percentage when no of sample request hit the server.

  6. 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.

  1. 90%line - 90% of the user out of samples have not taken more than “x”ms to get the response

  2. 95%line - 95% of the user out of samples have not taken more than “x”ms to get the response

  3. 99%line - 99% of the user out of samples have not taken more than “x”ms to get the response

  4. 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:-

  1. Open cmd/terminal in administrator mode

  2. Navigate to bin directory in apache folder by using cd

  3. Save all your jmx file in bin folder with .jmx extension

  4. Write (jmeter -n) = -n tells to run tests without opening jmeter means it is running in NonGUI mode.

  5. Then write (-t Name of file.jmx)= means -t stands for test plan which we are executing.

  6. To see the result we add another parameter.

  7. Write(-l C:\Results.csv) where -l stands for result file and .csv is the extension of the result file.

  8. -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/"


 

Related Tags

About Author

Author Image
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.

Request for Proposal

Name is required

Comment is required

Sending message..