Performance Testing with JMeter

JMeter is the solution of Performance testing for the small size company but it’s not like that big company can not be used. Actually It is the open source free software and no need to pay any bucks for this. It is the Jakarta project and released under Apache license. It is desktop application and purely based on Java technology.

If you want to use JMeter in Windows machine then you need only JDK 4.0 or extended version. Just download JMeter from Apache Jakarta Projects and unzip the file any desired location. Now open the command line and go through unzipped file and run jmeter.bat file. It will open the JMeter window.

Well, first we discuss about Web Performance Testing. So Before starting with JMeter I want to clear some important terms of JMeter which will see during creating web test plan.

Test Plan: Here we plan our performance case according to needs and requirement. This is starting point of any performance testing in JMeter.

Thread Group: Thread Group is the beginning point of any Test Plan. Thread Group is set of request that simulate the user actions and all the elements of Test Plan should be under Thread Group. It works like LoadRunner Scenario. In Thread Group we define the Number of User, Ramp Up, and Loop Count.

  • Number of Thread (User), as a name we define the number of users, who will simulate the performance test steps.
  • Ramp-Up option used to set the time that waited between each and every user run. Suppose if you have define 5 then each and every user will activate after 5 seconds. All the time will be in seconds.
  • Loop Count is the option where we set that how many times users will repeat the actions.

Sampler: With the help of sampler JMeter send the request to web server.

Listener: Listener is same as Result window of any tools. It will help to analyze the test result. JMeter provides different kind of Listener which we used according to our needs.

See JMeter is having lots of element of Test Plan but these are enough to create sample script for Web Application. For the more details about Test Plan element refer this link.

In JMeter we can create Web Test Plan in two ways-

  • Add the Sampler Manually
  • Add the Sampler through Recording

First I want to discuss that how to create test plan manually-

Just open the JMeter through jmeter.bat file.

Now this is the screen where we will add our test plan.

Every test plan starts with Thread Group so we should add thread group first. For add the Thread Group, just select Test Plan > Click mouse right click > Select Add > Select Thread Group and left click of mouse. It will add Thread Group in your test plan.

Now time to fill some data in Thread Group screen. According to your needs just fill the data in Number of Threads (Users), Ramp-Up, and Loop Count fields.

After adding Thread Group in test plan, we need to add HTTP request default in Thread Group. For adding this- Select Thread Group > Click right click of mouse > Select Add > Select Config Element > Select HTTP request default.

Fill the only Server Name/IP field and port number. For example Server Name: codemunch.com, port: 80

Now the time to add sampler with this thread group. Select Thread Group and right click > Select Add > Select Sampler > Select HTTP Request. Now configure the sampler, fill only Path field because you have already configure the Server Name in HTTP request default.

At last, just add the Listener with this thread group. Select Thread Group and right click > Select Add > Select Listener > Select View Result in Table.

We have created the one sample script and now the time to run this script. In JMeter we can run the script in two ways-

  • Run > Start
  • Ctrl+R

But before running this script just select the listener. It will display your result of test plan.