Home Jmeter Using JMeter for a Simple Test
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Using JMeter for a Simple Test

Advertisement
Lets see how to run JMeter now. We will conduct a simple test to set up a test plan and stress test a Web application. Before proceeding with the test we need to have a test plan first which will help the Jmeter to perform the testing in steps.

Using JMeter for a Simple Test

     

Lets see how to run JMeter now. We will conduct a simple test to set up a test plan and stress test a Web application. Before proceeding with the test we need to have a test plan first which will help the Jmeter to perform the testing in steps. There are several elements in a test plan like thread groups, listeners, assertions, sample generating controllers, logic controllers etc. Well, these elements will be described later. One point to remember here is that a test plan must have at least one thread group having all other JMeter elements which is the starting point of a test plan. All of the other threads created by the Jmeter to simulate simultaneous users will be controlled by this thread group. Lets go through the steps now.

Step 1: Start JMeter by running the JMeter.bat file for Windows or the JMeter file on Unix.

Step 2: Create a thread group by right-clicking the Test plan element as shown in the picture below. Now select ADD and then the Thread group option. After selecting the thread group option a thread group element will be created by the Jmeter under Test Plan element. This is to confirm about the number of users to be stimulated by you and the number of times the test plan to be repeated. 

The screen after creating the Thread group appears like this.

Following properties can be set as shown below:

Name -- You can give any name to the thread group.     
Number of Threads -- You can enter as many threads to stimulate a load test. A single user is represented by each Thread so if you wish to simulate a load test with 5 concurrent users then you need to enter 5 as the value for this property. 
Ramp-Up Period --
It indicates the time taken by Jmeter to create all of the threads needed. If you set 10 seconds as the ramp-up period for 5 threads then the JMeter will take 10 seconds to create those 5 threads. Also by setting its value to 0 all the threads can be created at once.    
Forever -- If you choose this option then the Jmeter will keep sending the unspecific requests to the tested application. And if disabled then the test will be repeated the number of times entered in the Loop Count box.    
Loop Count --
By specifying its value Jmeter gets to know that how many times a test is to be repeated provided that the Forever check box should be unchecked.   

Step 3: Now you need to mention the HTTP request (URL and parameters). To this right click on the Thread Group node then you need to select Add -> Sampler -> HTTP Request as shown in the picture.

The picture below shows the screen of HTTP Request in which you can set some properties as described below. Here address which we have taken for the "Hello World" servlet is http://localhost:8080/examples/servlets/servlet/HelloWorldExample.

The following properties can be set on the HTTP Request screen.  

Name -- You should put a descriptive name as a thread group can have multiple HTTP Request elements.    
Server Name or IP -- Mention the server name or the IP address of the machine which is running the application to be tested.
Port Number -- Give the port number on which the Web applications run which is usually 80.  
Protocol -- Mention the protocol to be used here i.e. either HTTPS or HTTP.
Method -- The GET or POST method is to be mentioned here.   
Path -- You need to mention the path of the resource that will handle this request.   
Follow Redirects -- follows redirections, if any, sent by the Web application.
Parameters -- This option shows the list of parameters sent with the request. You can add and remove parameters by using Add and Delete buttons.
Send a file with a request -- With the help of this option a file upload can be simulated to the Web application.
Retrieve all images and Java Applets -- This option is used to download embedded content.

Step 4: Now the format of the results is to be selected to get a page containing the results of every request by right-clicking on the Thread group node then select Add -> Listener -> View Results Tree.

Step 5: Now its time to run the Test plan by selecting Run from the menu and then select Start (or Ctrl-R): Hence The test plan will be repeated 10 times in View Result Tree as shown below.

 

Step 6: The results can been seen in the Results Tree after the completion of the Test plan. As you can seen in the picture below we have selected the first request in the upper pane and also the request which was generated with the results in the form of an HTML page with the text "Hello World!"

 

 

Step 7:  JMeter has got an interesting feature which is Add more listeners. You can add a View Results in Table listener to view the requests in tabular form as shown below.

Moreover you can add an Aggregate Report listener to get the summary of run as shown below. 

     
Step 8: To save the test plan for later use select File from the menu and then Save Test Plan (or Ctrl-S). Its preferable to save the test plan before running it.

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 28, 2008

Ask Questions?    Discuss: Using JMeter for a Simple Test   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Vivek
May 24, 2011
JMeter

Excellent tutorial to get started. I could get going with JMeter in 10 minutes Thank you so much!
sunil
June 27, 2011
correlation

hi friends can some plz explain step by step procedure for correlation. Thanks in Advance
Naveen
March 8, 2013
JMeter

This is Simply superb to get started
Vishal
October 18, 2011
Learn JMeter

rqewqewqw
vikram
October 28, 2011
need some help in running j meter tests

Hi I have to perform testing using jmeter to iterrate through my jsp and java application. I had followed all the steps seen in this website nd a few other websites as well. But i think i need some help to generate the summary report as i am not able to link and run my jmeter to the local jost server. can you help me on that. Thank you Vikram
Yogesh
November 5, 2011
java request example for jmeter

i want to sent a request server using java class and that sent request needs to tested by jmeter how can i do....plz help me as soon as possible
sivakumar
November 10, 2011
Excellent to understand

Really so helpful this is to understand and run a sample test plan
Arpan
December 4, 2011
thanks you

thank you for posting this tutorial :-)
Kaylyn
December 13, 2011
LedHLaAGLwzN

Woah nelly, how about them apelps!
Mukesh singh
January 25, 2012
thankss

thankss alot..
Amit
January 27, 2012
Jmeter installation

Please let me know how to install Jmeter in Ubuntu.
Azam
February 7, 2012
Very Simple to understand

Very Simple to understand
Suja
April 2, 2012
Integrating jmeter with jenkins

Could you please help me in integrating jmeter with jenkins
Trupthi Mahesh
April 5, 2012
Reading the Report in Jmeter

how to Read the Report in Jmeter please guide step by step
surendra
April 11, 2012
j meter steps

it's very much help me a lot thanq
madasamy
June 20, 2012
thanks

This document is very usefull for me..
Can you plz provide the steps to create POST request in JMETER?
October 5, 2012
POST request in JMETER

It would be great if the same kind of guide is provided for creating POST requests in JMETER.
JAGADEESWARA REDDY
July 11, 2013
About Monitor Results.

Hi, I can't able to generate monitor results. Can some one please help me out.
Terry
October 24, 2013
good tutorial

Thanks, this is a nice little tutorial for getting up and running with jmeter very quickly! The documentation for jmeter is very thorough but not written in a step-by-step style.
DMCA.com