Performance testing with JMeter – How to Basics

I have tried to chip in some basic steps on how to use JMeter for the performance test. This will help any user to download JMeter and run a test.

 

  1. Go to http://jmeter.apache.org/
  2. Click on “Download Releases” link from Download menu.

1

For just using the tool we need only the binary release. The screen below shows the current version at the time of writing this document. Click on the ZIP version given below and use any standard UNZIP utility to extract the files.

2

Alternately we can save the TGZ file and extracted the contents by using 7Zip utility for windows.  After extracting the TGZ file we get a folder named Jakarta-JMeter-n.n.n, where n.n.n is the version number which we downloaded.

 

Starting Apache JMeter tool:

The executable script for Windows platform is jmeter.bat for Linux systems it will be JMeter.sh.
These scripts are used to start JMeter in GUI mode.  Double click the jmeter.bat script to start the tool. Or else we can start JMeter by using a command prompt.

For windows, if zip file is unzipped at C drive, then path for the jmeter.bat is

C:JMeterjakarta-JMeter-2.6bin

3

Double clicking the jmeter.bat file will start one command prompt and the JMeter utility in GUI mode.  The command prompt is tied with the GUI and hence cannot be closed.  If the command prompt is closed the GUI will terminate.  We can keep the command prompt minimized while working with JMeter GUI.  The command prompt is useful in viewing any JMeter exceptions that may occur.

 

JMeter proxy Step-by-step

This document explains the exact steps for JMeter’s proxy. One easy way to create a test plan is to use the Proxy. Proxy is used to record the requests sent to the server.

 

Basic Proxy Instructions

1. Go to JMETER_HOME/bin and start JMeter.

2. Select “Test Plan” on the tree

3. Right click on the “Test Plan” and add a new thread group: Add > Threads (Users) >

Thread Group

4

4. Select the Thread Group

5. Right click “Add -> Config Element -> Http Request Defaults”

5

6. In new HTTP Request Defaults element: Server name – enter “www.google.co.in”

7. Path – leave blank

6

8. Right click on the “Thread Group” and add a recording controller: Add > Logic Controller >Recording Controller

7

9. Next, select WorkBench

10. Right click on WorkBench and add the Http proxy: Add -> Non-test elements -> Http

Proxy Server

8

11. On HTTP Proxy Server, click the “Add” button in “URL Patterns to Include”. This will create a blank entry.

12. Enter “.*.html”

13. Click 3 times, the “Add” button in “URL Patterns to Exclude”. This will create 3 blank entries.

14. Enter “.*.png” pattern, “.*.gif” pattern and “.*.ico” pattern

9

15. Right click on “HTTP Proxy Server” and add a listener: Add -> Listener -> View Results Tree.

10

16. Return to HTTP Proxy Server, and click the “Start” button at the bottom

11

Configure your browser to use the JMeter HTTP Proxy

At this point, JMeter’s proxy is running. We will use Firefox to view some pages on Google

  1. Start Firefox, but do not close JMeter.
  2. From the tool bar, click “Options”. This should bring up the options.
  3. Select the “Advanced” tab, and “Network” tab
  4. Click “Settings” button near the bottom.
  5. On the new popup, check “Manual proxy configuration”. The address and port fields should be enabled now.
  6. Address – enter “localhost” or the IP address of your system
  7. Port – enter “8080”.
  8. Check “Use this proxy server for all protocols”
  9. Click “ok” button
  10. Click “ok” button again. This should return you to the browse

 

Record your navigation

  1. With your browser, in the “Address” bar at the top, enter “www.google.coml” and hit the “enter” key.
  2. Enter some search string in the google search.
  3. Click on few links available on the result page.
  4. Close your browser and bring up the JMeter window.
  5. Select “Thread Group”
  6. Right click “Add -> Listener -> Summary Report” to add summary listener.
  7. The summary listener will show some basic statistics.
  8. Select “Thread Group”
  9. Number of Threads – enter “5”
  10. Ramp up Period – do not change
  11. Loop Count – enter 100

 

Start the test

At this point, we are ready to run our test plan and see what happens. Save the test plan.

When you’re ready to run the test, there are two ways:

1. Run -> Start

2. Ctrl–R

Before you start the test, select “Summary Report”. As the test runs, the statistics will change

until the test is done. At the end of the test, the summary report should look like this.

While 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.

Talk to us
Posted in:

Leave a Reply