jump to navigation

Testing using Apache jMeter September 11, 2007

Posted by Phill in Open Source, Testing, Tutorials.
Tags: ,

Apache jMeter is a popular utility used for performance testing. It can be used to test a wide variety of applications, including Web Applications, LDAP Servers, FTP Servers etc. As I had to use it recently to performance test a Struts-based web application, I thought I’d write up a short introduction to using it.

The first thing you’ll need to know is about Thread Groups. These contain a variety of requests which a typical user might make (something like a use case). For example, if you were testing a ‘Change Password’ function then the sequence of steps would be Login -> Go to ‘Change Password’ page -> Submit new password. This would be represented by a thread group. If your application is simple you may not need more than one thread group; if it’s more complicated you may want several thread groups to test all the use cases.

Once you’ve created a new Thread Group you’ll need to create some HTTP Requests to model the sequence of pages your user will navigate. This, of course, will depend on the exact page parameters and so on that you have set up. It’s probably best if I run through an example – I’ll demo how to set up a login test.

Assume you have a login system set up, so that you have to POST a username and password to http://server/demo/Login.do. This then sets your session cookie and sends a redirect to /demo/Home.do.

  • Start up JMeter, and create a new Thread Group under ‘Test Plan’
  • Right Click on the Thread Group you have just created, and select: ‘Add -> Config Element -> HTTP Cookie Manager’. This is very important if your application depends on J2EE sessions (which is likely, if you need to test a login).
  • Add another item from the same menu – ‘HTTP Request Defaults’. This lets you set up a series of defaults which apply to every HTTP Request (unless you override them), meaning that you don’t have to type out the server name for each request! In this example, you would set the server name to ‘server’ and leave the rest of the fields as their defaults.
  • Add an HTTP Request (Add -> Sampler -> HTTP Request) to the Thread Group
  • Change the method to POST, and the path to “/demo/Login.do”
  • Add two parameters to the request (underneath “Send parameters with the request”) – username and password. In our example it doesn’t really matter what the username and password are set to!
  • You’ll want to validate that when you login, you are actually taken to the home page. This can be done using ‘assertions’. Right-Click on the HTTP Request, and select ‘Add -> Assertions -> Response Assertion’. Then, on the assertion properties screen, make sure ‘URL Sampled’ is selected and then click on the ‘add’ button at the bottom. Enter the pattern “Home.do” in the “Patterns to test” section.
  • In order for you to see the results, you need to add a Listener. Right-click on the thread group and select Add -> Listener -> View Results Tree. I find the ‘View Results Tree’ quite helpful for web applications, although they are all useful for different things!

The test plan tree should now look something like this:

JMeter Screenshot

Your test plan is basically ready to run. Unfortunately you probably can’t (because you don’t have an application set up exactly like the example), but hopefully it gave you an idea of the basics of using JMeter to test web applications…

The next step is to try it out, and consult the User Manual to get a flavour of what the different samplers etc actually do!



1. Mai - March 28, 2008

This is the good detail to guide user to know Jmeter.My project use the steps seem with your detail.However I will use it to input XHTML soon.If you have some suggestion.Do not hestitate to advice me in e-mail.

Thank you&Best regards,


2. Philips - April 7, 2008

I am very new to this Jmeter. It is very helpful. But I wan t test a public website like google or yahhoo. how can I do that, what I write in the Path fields, What are the other important parameters needed for such testing. Please help me..

regards ,

3. Pankaj - August 4, 2008

I am new to jmeter and I have been getting Error % as 100% always (under “Aggregate Result”). Please given your input.


4. Ravi - October 27, 2008

This is very excellent and a short guide for programmers who are really interested to do some kind of Perfomance test using Jmeter.

many thanks to Phill.

I have set up the JMteter in my linux box ..used your steps verified my webapp application and captured the results and done.

I have a question to Phill..
1. How do I perform a service level of testing using JMeter?
you can send reply to my mail Id rg261968@yahoo.co.in

Thanks in IN advance

5. Ravi - October 27, 2008

My earlier question is “How do I perform a service level testing by calling a Junit thru JMeter?”

6. Marai - November 20, 2008

Jmeter recording using Proxy server: There are many problems while recording through the proxy servet , please give complete details about how to set the parameters for the server & port setting in the work bench & lan setting in the browser.

7. sushma - February 23, 2009

Reporting has become abig problem using Jmeter, can anyone please Help On this.., as the excution is done completely in backend and there is no active screen to look and know abt the error, we will just know it once all the script is executed, how can we handle this is their any option to take care…..

8. Manish - April 25, 2009


i am trying to test yahoo.com, i entered location as http://www.yahoo.com, but it dose not display result, can any one help me to solve this prob.


Navaraj Javvaji - June 28, 2010

Configure HTTP Proxy server in workbench and record it ,it will record the threads then move to test plan ->thread group ,from this you can easily test the yahoo.

for more details refere J meter manual configuring Proxy server

9. rajasekhar - August 30, 2010

give us a test site or some test web application too to test the jmeter

10. Blogger - October 26, 2010

For anyone seeking more info on Load Testing, this might be of help: http://alm.parasoft.com/load-testing-web-services/

11. prabu - May 18, 2012

am new to jmeter and I have been getting Error % as 100% always (under “Aggregate Result”). Please given your input.
and one u have any shout able Manual document pls send me prabu_k1981@yahoo.co.in

Sorry comments are closed for this entry

%d bloggers like this: