Thursday, October 14, 2010

JMeter : Setting up a HTTP Proxy to capture traffic

You can build up a JMeter test plan yourself but it's much easier to set up a proxy and let JMeter do all the grunt work for you.

There are some JMeter proxy Step-by-step instructions here.

If your environment has a proxy you need to tell JMeter about it via the command line e.g.

jakarta-jmeter-2.4\bin>jmeter -H -P yourProxyPort

The basic idea is that you change your browser settings to point to the JMeter HTTP Proxy and then the JMeter proxy forwards the packets to the real proxy configured in the command line.

To setup the JMeter proxy after you have started up JMeter, right click:


Add / Non-Test Elements / HTTP Proxy Server

Choose a spare port (in this case 9090) and configure in the Port box.

Now you need to change your browser settings. Use

Tools / Internet Options / Connections / LAN Settings / Proxy Server

Set the proxy server to localhost (or and the port number to 9090.

In JMeter, right click Test Plan / Add / Threads / Thread Group.

Doing this forces the proxy to capture the traffic inside of the plan.

Now click on HTTP Proxy Server and click Start at the bottom.

Now open your browser and browse to the URL you want to test.

In JMeter, you should see something like:

Note that it's a good idea to add a HTTP Cookie Manager as well as this enables cookies to pass between pages.


1 comment:

sugi said...

Thanks it works great