Running your first load test with JMeter

  • Jaluram Matoria
  • 0
  • 2017-05-29

Apache JMeter is an Apache project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications.

Apache JMeter has a lot of strengths as tool. It can be used as a unit-test tool for JDBC database connections, FTP, LDAP, Webservices, JMS, HTTP, generic TCP connections and OS native processes. One can also configure JMeter as a monitor, although this is typically considered ad hoc rather than advanced monitoring. It can be used for some functional testing as well.

JMeter supports variable parameterization, assertions (response validation), per-thread cookies, configuration variables and a variety of reports.

Now Let’s see how to setup JMeter on your windows Machine:

Step 1) Install Java:
Because JMeter is pure Java desktop application, it requires a fully compliant JVM 6 or higher. You can download and install the latest version of Java SE Development Kit.

Java Platform (JDK)

After installation is finished, you can use the following procedure to check whether Java JDK is installed successfully in your system

  • In Window/Linux, go to Terminal

  • Enter command java -version

If Java runtime environment is installed successfully, you will see the output as figure below

If nothing displays, please re-install Java SE runtime environment

Step 2) Download JMeter

As of this writing, the latest version of JMeter is Apache JMeter 3.2. You can download it here

Choose the Binaries file (either zip or tgz) to download as shown in figure below

Step 3) Installation

Installation of JMeter is extremely easy and simple. You simply unzip the zip/tar file into the directory where you want JMeter to be installed. There is no tedious installation screen to deal with! Simple unzip and you are done!

Once the unzipping is done, installation directory structure should look like as figure below

Given below is the description of the JMeter directories and its importance JMeter directory contains many files and directory

  • /bin: Contains JMeter script file for starting JMeter

  • /docs: JMeter documentation files

  • /extras: ant related extra files

  • /lib/: Contains the required Java library for JMeter

  • /lib/ext: contains the core jar files for JMeter and the protocols

  • /lib/junit: Junit library used for JMeter

  • /printable_docs:

Step 4) Launch JMeter

You can start JMeter in 3 modes

  • GUI Mode

  • Server Mode

  • Command Line Mode

Start JMeter in GUI Mode

If you are using Windows Machine, just run the file /bin/jmeter.bat to start JMeter in GUI mode.

Start JMeter in Server Mode

Server mode is used for distributed testing. This Testing works as client-server model. In this model, JMeter runs on server computer in server mode. On client computer, JMeter runs in GUI mode.

To start the server mode, you run the bat file bin\jmeter-server.bat

Start JMeter in command line mode

JMeter in GUI mode consumes much computer memory. For saving resource, you may choose to run JMeter without the GUI. To do so, use the following command options

This is a command line example

$jmeter -n -t testPlan.jmx - l log.jtl -H -P 8000

Now let’s see how to run your first load test with JMeter:

First some terminology

JMeter tests are built around the idea of a test plan. Within a test plan you can have Thread Groups, controllers, listeners, timers, assertions, and other elements. Each test plan is a performance test scenario - it's the series of steps JMeter will execute when you run the plan. The following table gives a brief overview of the basic elements you can include in a test plan.



Thread Group

As with any load test, execution is multi-threaded. The thread group element is what controls concurrent connection to your application. In end user terms, it's your group of users.


A sampler is the basic type of controller. Very simply, samplers tell JMeter to send requests (HTTP, SOAP, etc…) to a server. There are also Logic Controllers, but we won't be using one in this tip.


Listeners are what you use to access to the information JMeter gathers while running. They give you the pretty charts


Timers are how you set delays in JMeter. Timers fire before each request that a thread makes.


Assertions, like in any test tool, allow you to check for specific behavior as your test executes. Assertions provide the standard pass/fail results.

Building your first test

When you first open JMeter, you should be greeted with an empty Test Plan.

To add elements to a Test Plan, you can either right-click on it, or with it highlighted select Edit -> Add from the menu. The option of either right-clicking to add elements or using the menu to add elements will be true for all the items we talk about in this blog. To reduce confusion, I'll be referencing object by asking you to right-click on them.

The first thing we need to get a test running is a Thread Group. To add a Thread Group, right-click on the Test Plan and select Add -> Thread Group

Here I am running a test with 10 threads or users. In addition, we'll set the ramp-up period to 2 seconds, and we'll have each user search ten times.

Once we have our Thread Group configured, we're ready to add a timer. We'll be using a Constant Timer between transactions to space them apart. To add a timer, right-click on the Thread Group and select Add -> Timer -> Constant Timer.

Set the thread delay to three seconds - or 3000 milliseconds. At this point we're ready for our HTTP request. To add a request, right-click on the Thread Group again and this time select Add -> Sampler -> HTTP Request.

For the example, I want to have you run a simple search on Yahoo. To do that, set the Server Name to ''. That tells JMeter what server you're hitting. Then for the path, I want you to enter '/search?p=testing'. That's the same as if you went to Yahoo's homepage and did a search on the word 'testing'. You can leave everything else on the page set to the defaults.

When I'm testing, I always want to know that what I did had the desired effect. So, we're going to add an assertion to our test. To do that, right-click on the HTTP Request element and select Add -> Assertion -> Response Assertion.

Here we want to check that we’re getting search response back.

Next, we're going to add a couple of listeners so we can see our results. I like the Graph Results and View Results as Table listeners. They both offer intuitive interfaces. To add a Graph Results listener, right-click on the Thread Group and select Add -> Listener -> Graph Results.

You now have a simple test ready to go. Go ahead and save your Test Plan.

Running your test
Once you've saved your test, you're ready to run. From the menu, select Run -> Start.


Follow Teknotrait Solutions on

Comments (0)

Recommended Read