Thursday, December 1, 2011

Jmeter - Open Source Performance Tool

JMeter proxy Step-by-step

This is one of the easy way to create a test plan is to use the Proxy. The proxy does is it
records the requests sent to the server. Jmeter's proxy currently does not support recording
HTTPS. Since HTTPS is secure, the proxy is unable to decrypt the traffic and record the
request parameters or cookies. In my point of view easiest method is to use Badboy, there you can record the script and you can save as to “Export as Jmeter”. Another option is to
record in HTTP and then change the test plan to use HTTP request defaults.

Basic Proxy Instructions
1. start Jmeter with jmeter.bat on windows and jmeter.sh on unix
2. select “test plan” on the tree
3. right click on the “test plan” and add a new thread group: add -> thread group
4. select the thread group
5. right click “add -> config element -> Http Request Defaults”
6. Protocol – enter “HTTP”
7. Server name – enter “jakarta.apache.org”
8. Path – leave blank
9. Port number – enter “80”
10.select workbench
11.right click on workbench and add the Http proxy: add -> non-test elements -> Http
Proxy Server
12.Port field - Enter “9090”
13.Target Controller – click on the drop down and select “test plan > thread group”
14.Click the “add” button in “Patterns to include”. This will create a blank entry.
15.Enter “.*\.html”
16.Click the “add” button in “Patterns to exclude”. This will create a blank entry.
17.Enter “.*\.gif”
18.Click the “start” button at the bottom
19.Start Internet Explorer, but do not close Jmeter.

Common patterns for images and types of pages.
.* - all
.*\.png – png images
.*\.gif – gif images
.*\.jpg – jpeg images
.*\.php
.*\.jsp
.*\.html
.*\.htm
.*\.js

NB: set the homepage for your browser to a blank page. This
way, it reduces the number of unwanted pages Jmeter records during the session. It is a good
idea to try the proxy with different sites and get comfortable with different filtering patterns.


20.From the tool bar, click “tools -> internet options”. This should bring up the options.
21.Select the “connection” tab
22.Click “lan settings” button near the bottom.
23.On the connections tab, check “Use a proxy server for your LAN”. The address and port
fields should be enabled now.
24.Address – enter “Localhost” or the IP address of your system
25.Port – enter “9090”.
26.Click “ok” button
27.Click “ok” button again. This should return you to the browser
28.In the “Address” bar at the top, enter “http://jakarta.apache.org/jmeter/index.html” and
hit the “enter” key.
29.Click on a few links on Jmeter's page.
30.Close internet explorer and bring up the Jmeter window.


Reviewing the Test Plan
Expand the thread group and there should be several samplers. At this point, the test plan
can be saved as is. If you forget to add default http request settings, you will have to
manually delete the server name, and port. In this sample, there aren't any default request
parameters. If a particular request parameter is required by all pages, the request defaults is
where one would add the entries.

Results

1. Select “thread group”
2. Right click “add -> listener -> aggregate report” to add an aggregate listener. The
aggregate listener will show some basic statistics.
3. Select “thread group”
4. Number of threads – enter “5”
5. Ramp up Period – do not change
6. Loop count – enter 100

Number of threads- Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.
Ramp up Period - The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, 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.
Ramp-up needs to be long enough to avoid too large a work-load at the start of a test, and short enough that the last threads start running before the first ones finish (unless one wants that to happen).
Start with Ramp-up = number of threads and adjust up or down as needed.

Running the Test
Now you can run your 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. CRTL + R
Before you start the test, select “aggregate report”. As the test runs, the statistics will change
until the test is done. At the end of the test, you can see the aggregate report.

While the the test is running, in the upper right-hand corner, there should be a green square.
When the test is done, the box should be grey.






1 comment:

Praveen Kumar said...

Can JMeter record HTTPS requests using the recording proxy?

In JMeter 2.4. JMeter now uses its own dummy certificate which the browser needs to be configured to accept.