What is JMeter?
JMeter is an Apache Jakarta project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications.
Installation
Please refer to http://jakarta.apache.org/JMeter/ download latest stable version and install.
Scope of this document
Scope of this document is only to give a quick start for how to use JMeter, for detailed information please refer to user manual http://jakarta.apache.org/jmeter/usermanual/index.html
Quick Start
- Start JMeter (for windows <JMETER_HOME>/bin/jmeter.bat for linux its <JMETER_HOME>/bin/jmeter )
- Add a proxy
- Add a thread group
- Go to Internet Explorer Tools → Internet Options → Connections → LAN Settings
- Go to Proxy server
- Start Internet Explorer
- Stop HTTP Proxy
- If you want to run multiple scenarios in parallel, add multiple thread groups and repeat from step 3.
- You can add different listeners to views the statistics of test plan.
- Save the Test Plan
- If you are planning to run the recorded script for a different web server then do the following
- If you want to run the JMeter script from a different machine then do the following
- Start JMeter
- Open test script and click run from the menu bar.
a) Right click Workbench -> add -> Non-Test Elements → HTTP Proxy Server.
b) Change the port accordingly in HTTP Proxy Server.
c) In URL patterns to exclude in HTTP Proxy Server add the following
.*\.jpg
.*\.png
.*\.gif
.*\.css
(a) Right click Test Plan → add → Thread group
You can rename the thread group
(b) Right click Thread group → add → Config element → Http Cookie Manger
Set Cookie policy to compatibility
(c) Right click Thread group → add → Logic Controller → Simple Controller
You can rename the Simple Controller
Enable proxy server option and configure the port and IP as localhost which is configured in HTTP Proxy Server
Select Correct target controller ( eg : Thread Group → Simple Controller)
(d) Start proxy
Enter the web application address (eg: http://10.11.12.14:8080/test-site ) in the internet explorer address bar and do all the steps that you want to perform.
All the steps and actions you have performed in the Internet explorer will be stored under target controller. (eg : Test Plan → Thread Group → Simple Controller)
Eg: Right click Test Plan → add → Listener → Summary Report
(a) Open the saved JMeter script in a text editor.
(b) Suppose the web address you have used for recording the script was http://10.11.12.14:8080/test-site and you want to change IP to 10.11.12.13 and port to 9999.
(c) search 10.11.12.14 in the text editor and replace with 10.11.12.13 Search 8080 in the text editor and replace with 9999 Save the plan
(a) suppose the test plan recorded machine is 10.2.3.4 and you want to run jmenter script from 10.2.3.5
(b) Transfer the JMeter script (test plan) to 10.2.3.5
Reference
[1] JMeter User Manual http://jakarta.apache.org/jmeter/usermanual/index.html