Tuesday, March 17, 2020

Apache JMeter

What is JMeter?

Apache Jmeter is a popular open source performance testing tool. You can use JMeter to analyze and measure the performance of web application or a variety of services. Performance Testing means testing a web application against heavy load, multiple and concurrent user traffic. JMeter originally is used for testing Web Application or FTP application. Nowadays, it is used for a functional test, database server test etc.

Why JMeter?

Have you ever tested a web server to know how efficiently it works? How many concurrent users can a web server handle?

Let say that one day, your boss asks you to do performance testing of www.google.com for 100 users. What would you do?

It's not feasible to arrange 100 people with PC and internet access simultaneously accessing google.com Think of the infrastructure requirement when you test for 10000 users (a small number for a site like google). Hence you need a software tool like JMeter that will simulate real-user behaviors and performance/load test your site.

How does JMeter work?
The basic workflow of JMeter as shown in the figures below:

JMeter simulates a group of users sending requests to a target server, and return statistics information of target server through graphical diagrams.
Introduction to JMeter

The completed workflow of JMeter as shown in the figure below
What is Element in JMeter?
The different components of JMeter are called Elements. Each Element is designed for a specific purpose.
The figure below gives some common elements in JMeter.

Thread Group:

Thread Groups is a collection of Threads. Each thread represents one user using the application under test. Basically, each Thread simulates one real user request to the server.

The controls for a thread group allow you to Set the number of threads for each group.

For example, if you set the number of threads as 100; JMeter will create and simulate 100 user requests to the server under test.
Complete Element reference for Jmeter
Samplers:
As we know already that JMeter supports testing HTTP, FTP, JDBC and many other protocols. We already know that Thread Groups simulate user request to the server.

But how does a Thread Group know which type of requests (HTTP, FTP etc.) it needs to make?
The answer is Samplers.The user request could be FTP Request, HTTP Request, JDBC Request...Etc.
Complete Element reference for Jmeter
Listeners
Listeners: shows the results of the test execution. They can show results in a different format such as a tree, table, graph or log file.
Complete Element reference for Jmeter
Configuration Elements:
set up defaults and variables for later use by samplers.

The figure below shows some commonly used configuration elements in JMeter.
Complete Element reference for Jmeter
CSV Data Set Config:

Suppose you want to test a website for 100 users signing-in with different credentials. You do not need to record the script 100 times! You can parameterization the script to enter different login credentials. This login information (e.g. Username, password) could be stored in a text file. JMeter has an element that allows you to read different parameters from that text file. It is "CSV Data Set Config", which is used to read lines from a file, and split them into variables.
Complete Element reference for Jmeter

This is an example of CSV Data. It's a text file which contains user and password to login your target website.

If you want know more about Jmeter click on the below link..






Featured Posts