Sunday, September 11, 2005

JMeter in Web Application Testing

JMeter in Web Application Testing

Last week I was discussing with Kartik on performing JMeter performance testing on the Ripple product. They were facing some difficulties in HTTP session handling in their JMeter test plan. This conversation allowed me to refresh my knowledge on this powerful testing framework. So I thought of making a note about JMeter on my blog. This will be a quick and short overview on some of the general JMeter capabilities.

When considering the non functional testing we often hear people talking about different types of tests. Some of those are “Load testing”, “Performance Testing” or “Stress Testing” on the application under test. First of all it is important to know the meaning and differences of these terms used in application testing.

a) Load testing is applying a heavy load on the application and monitors the behavior of it under a heavy load.

b) Performance testing may be carried out to ensure the application responses within acceptable timing on the requests it’s getting.

c) Stress testing is for ensuring fault tolerance capability of the application. For an example we may restart the database while application is in operation and check whether the application can recover under such a condition.

Let's have a quick look at JMeter. JMeter can be readily used in Load and performance testing. The test scripts we may create are called ‘Test Plans’. We can have create several test plans to test our application. These test plans can be used even as automated tests by running JMeter in non graphical mode.

There are several types of elements in a JMeter test plan. JMeter uses ‘Samplers’ to produce requests. It has ‘Logic controllers’ so we can control our test flow with them (e.g. to repeat a request). ‘Listeners’ are used to capture test results. Delays may be introduced by its ‘Timer’ elements.

Session handling is an important activity in any practical test plan. For general cookie based sessions we may use a Cookie manager to keep our cookie based session information across the requests. But when URL-Rewriting is used in session management we have to use “HTTP URL-Rewriting Modifier’ to keep session information across requests.

For me one of the most interesting elements in JMeter is its assertions. For an example returning HTTP 200 by our server doesn’t always mean that the request has been served successfully. That may be a user friendly error message returned by the server when a critical error occurred. We need to be more specific and probably wants to check the returned html to validate the server response. This is made possible with ‘Assertions’ in JMeter.

When configuring our test plan sometimes we face difficulties in simulating the exact browser behavior with JMeter. One handy tool that would help here is ‘TCPMON’ tool comes with Axis utilities. We can capture and compare http communications of JMeter with the communications of browser easily with this tool.

It is really interesting seeing JMeter as a part of a automated testing environment together with JUnit and HTTPUnit test frameworks…

5 Comments:

Blogger creed said...

A beginners tutorial to JMeter at http://javaboutique.internet.com/tutorials/JMeter/index-1.html

4:04 AM  
Blogger 88Pro said...

I came accross this handy tool which works on top of httpunit.

http://webtest.canoo.com/manual/samples.html

However the test cases are specified in XML format instead of classes. I have not tried it out myself but if it works it makes a very good case for the QA members to automate some of their tests like the smoke test.

I see many time once a deployment is done, a request to QA goes to do a smoke test and all they need to do is run a script in most of the web applications.

5:20 PM  
Anonymous Anonymous said...

good content.. for starter still more information is required, can u give some example links..........
VASEEM

4:30 AM  
Blogger Hasith Yaggahavita said...

check this

http://javaboutique.internet.com/tutorials/JMeter/

8:20 PM  
Anonymous Anonymous said...

I am using Jmeter for performance testing. I need to check queues to make sure that all the process in the queue is completed. Also checked that the total number of users are present in the table on a specified page. Is this possible in Jmeter as I cannot seem to find a solution?

12:50 PM  

Post a Comment

<< Home