Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
Jmeter
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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.

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

13 comments so far (post your own) View All Comments Latest 10 Comments:

i want Jmeter demo thats it.

Posted by Suresh on Thursday, 05.29.08 @ 13:00pm | #61334

gud work

Posted by govinf on Thursday, 04.3.08 @ 16:55pm | #55225

This tutorial is a explains a basic level which is already mentioned in J Meter User Mannual.
This is least helpfull

Posted by yeddie on Wednesday, 04.2.08 @ 14:29pm | #55113

Excellent work which is really helpful for begineers, would like to have examples on JDBC request, LDAP and Junit which are highly used in real time.

Posted by devidoraiswamy on Tuesday, 03.4.08 @ 13:05pm | #51274

how to analyse the result exactly means how can we know and what parameters are used to know the performance is good or bad,

Posted by karthik on Wednesday, 02.27.08 @ 09:32am | #50271

Demo is superb. It is very clear to understand to the Jmeter unknow people. I want to give suggestion that if you give more examples like connecting to Data base, Webservices with some more examples it will be more good.

However the above presentation is very good.

Thanks
Prasad

Posted by prasad on Monday, 02.11.08 @ 18:13pm | #47909

Excellent work ............thank you very much

Posted by syed on Tuesday, 01.8.08 @ 14:43pm | #44784

Its really very easy to understand how to use Jmeter particularly for beginners. Great job

Posted by Ananth on Thursday, 12.27.07 @ 11:37am | #43929

this is a great help for JMeter starters like me.

Thanks a lot

Posted by New To JMeter on Wednesday, 12.19.07 @ 23:30pm | #43004

ThanK U somuch for such a good Post

Posted by Dona on Tuesday, 12.18.07 @ 16:30pm | #42829

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Hot Web Programming Job

Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.