Load testing with apache-JMeter



What is Load testing...?

Load testing is the process of putting demand on a software system or computing device and measuring its response. 

Why..?

Load testing is performed to determine a system's behavior under both normal and anticipated peak load conditions.



Load test frameworks

To perform a load test on a system, there are some tools that we need to be a little familiar with.

The following tools have been used to build the load test framework.


  • Github - To maintain the repository of the Load test project
  • Jmeter - To craft load test script as required
  • Taurus - To the convenience of maintaining the configurations of the load tests
  • Jenkins - To run Load tests at a scheduled time/ on-demand
  • Blazemeter - To record the request and export it as a .jmx file / To view test reports 


We can start doing the load tests from the beginning as following.

  1. Install Blazemeter     


  1. The requests of the process that need to be tested should be recorded. For that use the chrome extension for Blazemeter.

 

       2. Record the requests by clicking the start button in Blazemeter and doing the process on the web            UI.

       3. You need to login to BlazeMeter first.

       4. Then download the file as a jmx.

                    


  B. Install Jmeter  


  1. Install the JMeter binary. you can download it here

  2. To launch Jmeter,

  • cd to the downloaded folder

  • Run ./bin/jmeter.sh




JMeter 

Open your terminal and go to the bin folder of the apache-JMeter, where you have extracted the downloaded JMeter zip file (compressed file).

Use the following command in your terminal to open the GUI (Graphical User Interface) of Apache JMeter.


    - sh jmeter.sh

Now open the exported .jmx file via Apache JMeter.


Once the .jmx file is opened you will see the list of recorded requests in the left side panel of your JMeter window.



Disable the non-relevant requests for your load test, from the list of the requests given.

Add a listener to your test to check the response(s) for the request(s) that you are running.








Once you verify the requests are working properly, go to the  “HTTP Header manager” and replace the Authorization token with the Basic token you generated via Postman and Save.



Run the request(s) once again and verify that they are working properly.


To change the no of users



Use yml and jmx files in the same folder












               C. Install Taurus     


  1. Install taurus

For Mac:

  • brew install bzt

  • brew upgrade bzt


    For Linux:

  • sudo apt-get install python3 default-jre-headless python3-tk python3-pip python3-dev libxml2-dev libxslt-dev zlib1g-dev net-tools

  • sudo python3 -m pip install bzt


  1. To run .yml files,

  • bzt <file name>


To extract the id from the response,

  • Open the file in Jmeter

  • Go to the request whose response gives the id

  • Add Regular Expression Extractor in Post-processes

  • Fill in as required, according to the format of the response.




The load test can either be run using Jmeter or Taurus.

When run by Taurus it gives a BlazeMeter report when defined in the yml file (The jmx file downloaded by blazemeter is run using a yml file).


To run the file using Taurus,

  • bzt <file name>




After running the file using taurus it will give url




Postman  

Copy any request to your instance from the browser (More tools > Developer tools > Network), as a cURL request and import it to Postman.


Change the authorization type of the request to “Basic Auth” and set the Username to the logged in user of the system and the Password with the API Token generated for the system


Once the username and password is set, send the request once again and copy the value in the Authorization field starting with “Basic” to be used in the JMeter GUI.


Now you can start performing the load tests. Happy testing...😊😊














































Comments

  1. I got wonderful information from this blog. I enjoyed your blog... the way you presented is really awesome... Thanks for sharing with us...If someone wants to know about load testing services this is the right place for you.



    ReplyDelete
  2. Amazing article provided by the author. Know about what is okr here.

    ReplyDelete

Post a Comment

Popular posts from this blog

ස්ටීවන් හෝකින් (Stephen Hawking)

Why Functional testing?

Performance Testing in Software Testing