Pages

Getting Started with JMeter

The Apache JMeter™ desktop application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.
Apache JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.

Getting started

Download the JMeter binary from here (tgz, zip). Extract the file. You do not need to install jmeter on your computer. Go to the bin folder and run the jmeter.bat if you are in windows or jmeter.sh if you are in linux. After sometime you should see a window like this.

This is the dashboard of JMeter. You do not need to write any codes in jmeter. You just have to add the necessary readymade components in the UI, and then configure them to the particular thing you are trying to test. However, JMeter will generate a *.jmx file which contains necessary informations to start the same set test-plan the next time and you do not have to go through all the steps of arranging the component and configuring them everytime. You can just drag and drop the .jmx file to jmeter window to load the test. You are ready to create your first test plan using JMeter.

Preparing the TestPlan

Lets simulate a condition such that ten users are using google continuously each user clicking some request20 times and then see the performance of www.google.com  .
1.     First of all right click on the test plan and add a ThreadUsers->ThreadGroup.


This will add a component called ThreadGroup as a child component of the TestPlan. When you click on the component, its corresponding panel will appear on the right where you can control various things including its name that appears on the left component tree as well as on the final result.


Enter the values like this. This shows that there are 10 users and they will request 20 times each. So the total number of page requests will be 200. The ramp-up period is the gap of time in which the total request will be made.
2.     The second step is to add sampler(http-Request). The sampler is a component which makes a request to the server of component which you are trying to test. There are various kind of samplers (Ftp, Java, soap etc).
Right click the ThreadGroup and add Samplers->HttpRequestSamplers.



Enter “google.com” in the ServerName or IP text Box.


3.     This is the time to add some listeners.  A listener is a component which records the request and response data and lets the user see the actual data. Different listeners listens to the same data and provides different views of the result. Some focus on time taken, latency, while some shows graph. The “View results Tree” listener which we are using here will visualize the results sequentially with option to see the request data made and response data received. The “Summary Report” listener will show the metrices of the data and the times taken.
Right click the Thread-Group and add Listeners->ViewResultsTree, and Listeners->SummaryReport.



Execution

This is the time you run the test. Save the file with suitable name say “GoogleTest”. Then click the green triangle at the ribbon. 



The test will execute and you will be able to view the request and results in the “View results tree” sampler.


Summary

Thus you have successfully prepared a JMeter script to browse the web for the google with multiple users simultaneously make multiple requests. These kind of tests are very necessary for the production environment to verify that the server could handle expected number of requests per seconds.
This article covers very less features of the JMeter. But as the getting started concepts are much important, this is a good start. You could now yourself explore other features of JMeter. If I get any concern or query or feedback, I will post some other good practices and common issues in testing and how to solve it. :) Happy testing.


1 comment:

  1. Subject matter experts, or researchers, lending them more credibility. NordVPN 3 Years Deal Both blogs and articles can cover a wide range of topics, from travel and lifestyle to technology and science.

    ReplyDelete

If you like to say anything (good/bad), Please do not hesitate...