Introduction to JMeter : Load Testing using JMeter


JMeter is load testing tool used for testing load on site by multiple requests of users. JMeter version 2.4 does not support https requests. If you are using JMeter 2.4 version then you can use BadBoy recording tool for processing https requests. But Latest version of JMeter available in market is 2.8 which supports https requests.

Operating System:

 
JMeter is a 100% Java application and should run correctly on any system that has a compliant Java implementation.

JMeter has been tested and works under:
• Unix (Solaris, Linux, Fedora etc)
• Windows (98, NT, XP, Vista, 7 etc)
• OpenVMS Alpha 7.3+

Install JMeter:

1. JRE or SDK first needs to be installed with a JAVA_HOME environment variable.
2. Download Latest version of JMeter from http://jmeter.apache.org/download_jmeter.cgi
3. Extract this .zip or .tgz file in any directory.
4. Go to that path and open jmeter folder.
5. Type ./bin/jmeter on command prompt(for Unix) or Run bin/jmeter.bat (for Windows)
6. JMeter screen will open with 2 main components:
    - Test Plan
    - Workbench
 

Recording in JMeter:

1. JMeter:
- Right click on Workbench component and go to Add >> Non-Test Elements >> HTTP Proxy Server.
- Right click on TestPlan component and go to Add >> Threads (Users) >> Thread Group.
- Right click on Thread Group component and go to Add >> Logic Controller >> Recording Controller.


Introduction to JMeeter Load Testing using JMeter

2. Firefox settings:
- In JMeter, recording supports in Firefox browser. So, open Firefox and go to Tools >> Options >> Network >> Settings >> Manual proxy cofiguration.

- Add “localhost” or “127.0.0.1” in HTTP Proxy and "8080" in Port field. If added port is in use, we can add some other port number also.

Introduction to JMeeter Load Testing using JMeter

3. JMeter:
- In HTTP Proxy server screen, add same port number in Port field which we have entered in Firefox browser.
- From Target Controller dropdown, select option “Thread Group > Recording Controller”
- In some cases, when we don't want to consider page load time for images, javascripts, etc. then we can exclude them. In “URL Patterns to Exclude” section, Click on ADD button and Add exclude formats in the way like this .*\.jpg
- Now from HTTP Proxy settings screen, click on Start button to start recording.


Introduction to JMeeter Load Testing using JMeter





4. Firefox: Open URL which needs to be recorded.

5. JMeter: Check the recorded requests are coming under “Thread Group >> Recording Controller” component. Click on Stop button, when you want to stop the recording.

Add Listeners in JMeter to check results of the recorded requests:

1. Right click Thread Group and go to Add >> Listener >> Aggregate Report. We can also add Summary Report to check the details.
2. To verify whether requests are running correctly or not, we can verify it by adding a listener as “View Results Tree”. We can check error by clicking on each request in View Results Tree section.
 

Use of Thread Group Properties to apply Load to the recorded requests:
    
1. Click on Thread group.
2. In Thread group screen, check the “Thread Properties” option.
3. We can add the number of users for load test in “Number of Thread (Users)” option.
4. To increase the load gradually, add total time to add full load in “Ramp-Up Period (in sec)” field. The Ramp-Up Period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If Number of Thread (Users) is 10 and the Ramp-Up Period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.
5. To run the script multiple times, we can add value in Loop count field.

Example 1: 
Number of Threads (Users) = 100
Ramp up period(in seconds) = 600
Loop Count = 1

Every 6 second (600/100) one request hits the server. 

Example 2: 
Number of threads(users) = 100
Ramp up period(in seconds) = 600
Loop Count = 3

Every 6 second (600/100) 3 request hits the server.

Run the script:

From the Menu, go to Run >> Start and script will start executing.

Verify result in Reports:

As mentioned above, we can check results of the script in Aggregate Report, Summary Report, View Results Tree etc and also we can export the results to a file by using “Save Response to a File”. This file will get saved in /bin folder in 1.html format.











Thanks and Regards,

Prashant Vadher | QC Engineer

5 Comments:

Dzmitry said...

There are some updates in HTTP Proxy in latest Jmeter 2.9.
They've added "Add suggested excludes" button to allow programatically populate "URL Patterns to Exclude". Pre-defined values are located in jmeter.properties, in entry

proxy.excludes.suggested=.*\.js;.*\.css;.*\.swf;.*\.gif;.*\.png;.*\.jpg;.*\.bmp

Some more updates described in article JMeter 2.9: what's new?

Magnetic Crack Detector said...

From Target Controller dropdown, select option “Thread Group > Recording Controller.
Crack Detector Machine

Hemal Shrimarkar said...

Really you give great information to us onSoftware Testing Services. please share with us:- dynamics ax consulting.

Innovapath said...

Excellent Post. Also visit http://whiteboxqa.com/#performance.php

Hemal Shrimarkar said...

hii ,Your article is excellent, if you get information for testing visit on:Web Testing Services...

Post a Comment

 
Design by Prashant Vadher