Here will be described how to simply record traffic with Jmeter. The HTTP Proxy Server allows Jmeter to watch and record the traffic and stores them directly into the test plan.
First download and install all necessary packages:
1. Java
http://www.oracle.com/technetwork/java/javase/downloads/index.html
– After install setup the environment variables
2. Jmeter
Download Jmeter from following website, select the latest zip file:
http://jmeter.apache.org/download_jmeter.cgi
After download extract the downloaded zip file to folder C:\jmeter (or any favorite folder)
3. Jmeter plug-ins
Download Jmeter plug-ins from following website:
http://code.google.com/p/jmeter-plugins/
Extract the downloaded file and just copy the JAR files into JMeter’s lib/ext directory (C:\jmeter\lib\ext)
Run JMeter:
Go to “bin” folder (C:\jmeter\bin) and execute Jmeter file
Create a new test plan and click on Workbench. Click on Edit – Add – Non-Test Elements – HTTP Proxy Server
At the right side in Global Settings choose a free port. It is 8080 by default.
At HTTP Sampler Settings in Type padding menu choose HttpClient4.
Here you can define URL Patterns to exclude, if you leave the exclude field empty, all incoming trafic will be recorded.
Click 3 times on the “Add” button in “URL Patterns to Exclude”. This will create 3 blank
entries.
Enter “.*\.png” pattern, “.*\.gif” pattern and “.*\.ico” pattern
The next step is setting up the browser for traffic record. Change the proxy settings.
Firefox: Click on Tools – Options – Advanced – Network. Click on Settings
Click on Manual proxy settings and insert 127.0.0.1 into field HTTP Proxy. For port insert 8080, or if you changed the port in Jmeter HTTP Proxy, then use that port.
The next step is adding the Recording Controller. This will collect HTTP requests.
Click on Test Plan and click on Edit – Add – Threads(Users) – Thread Group
Click on Thread Group and at the right side change the next:
– Number of Threads – enter “5”
– Loop Count – enter ” 100″
Now click on Thread Group and click with mouse right button – Add – Logic Controller – Recording Controller
The HTTP Proxy Server will record samples under the Recording Controller.
Now add HTTP Request Defaults to the Thread Group
Enter into the field Server Name or IP enter localhost and into the Port Number field 8080 or port what you defined before.
Now the setting is finished and we are ready to record.
Start the Proxy server
Start with surfing in Firefox.
After surfing close the browser and expand the thread group – Recording Controller.
At this point you are ready to run the test plan and see what happens. Save the test plan.
When you’re ready to run the test, there’s two ways:
1. Run -> Start
2. Ctrl–R
Similar Posts from the author:
- Getting started with JMeter
- Configuring Selenium RC using Eclipse
- Mobile testing – Screen recording on Android – rooted device
- Mobile testing – Screen recording on Android – non-rooted device
- Screen recording – screencast – part II
3 thoughts to “Getting started with JMeter II – record traffic with Jmeter”
Excellent Post. Also visit http://whiteboxqa.com/#performance.php
Thank you !
Nice post. However the majority of users are facing different kinds of issues and asking questions like: how do I login? as you didn’t mention HTTP Cookie Manager
There is an excellent guide on how to make JMeter behave like a real browser – http://community.blazemeter.com/knowledgebase/articles/115022-how-to-make-jmeter-behave-more-like-a-real-browser
It covers additional areas which can make recorded load test to be more sensible
Comments are closed.