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

Download Jmeter

After download extract the downloaded zip file to folder C:\jmeter (or any favorite folder)

Extract Jmeter

3. Jmeter plug-ins

Download Jmeter plug-ins from following website:

http://code.google.com/p/jmeter-plugins/

Jmeter plugin download

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

Add HTTP Proxy

HTTP Proxy

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

Exclude

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

Firefox Proxy 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.

localhost

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″

Thread Group

Now click on Thread Group and click with mouse right button – Add – Logic Controller – Recording Controller

Recording Controller

The HTTP Proxy Server will record samples under the Recording Controller.

Recording Controller

Now add HTTP Request Defaults to the Thread Group

HTTP Request Defaults

Settings

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 the Server

Start with surfing in Firefox.

After surfing close the browser and expand the thread group – Recording Controller.

Recorded

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:

3 thoughts to “Getting started with JMeter II – record traffic with Jmeter

Comments are closed.