Introduction to JMeter

Apache JMeter is an Apache project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications. Wikipedia (JMeter)
This tool is one of the most professional testing tools that possesses three characteristics of my favorite softwares:
- Firstly, it’s opensource
- Second, it’s free
- And third, it can be installed and launched on various operating systems
Introduction to JMeter
Frequently, when I establish a web server, I test the server using JMeter once to find out how many clients can visit the website simultaneously.
Through JMeter we can test numerous protocols including FTP, HTTP, SMTP and LDAP, Even test a database server using JDBC.

JMeter listener lists
JMeter sections
As a result of close relationship between different parts of JMeter I decided to introduce the two main sections — test plan and thread group I mean — at the end in order to understand the concepts more efficient.
Samplers
Samplers are used to send a request to the destination server and as I explained above, we can send variety of requests.
The sampler used to send HTTP request is named after what it does, HTTP Request.
Listeners
Using listeners, we can observe all answers received from server.
It helps us to depict the output in different ways and achieve a good log of server.

List of listeners
These three are the most efficient listeners for me:
- View results tree
- Summary report
- graph results
Assertions
Assertions are used in order to make sure if recursive response from the server is right.
Based on this section, we can have more accurate information in the Samples section.
I took advantage of Response Assertion the most, which can examine the different sections of the recursive response from the server and tell us whether each of our requests sent to server has got a right response or not.
Fields like Response code become one of the renown HTTP response codes (200, 404, 500, etc.) when the sampler is Response code.
One of the other excellent assertions are Duration assertions, which uses server’s response time as an indicator of performance precision verification.
For instance, my API server is supposed to respond to client in 2 seconds tops, otherwise it will be useless.
So, I use duration assertion and assign the value 2000 for duration in milliseconds.

JMeter response assertion
Timer
Timer is used for making delay among samplers.
There are a variety of them like Constant timer which causes a constant delay between each request, or Gaussian Random Timer which causes a random duration of delay between each request.

JMeter timers
Thread group
This is the most important part of the test which is the start point of it as well.
In this part we can define threads, which are in fact the virtual users, as well as rate of client addition, and the frequency of test execution.
All controllers and samplers should be under thread group.
The remaining elements like listeners can be defined directly under Test plan.
Test plan
As it’s apparent from the name, the test plan is designed in this section. In fact, all stages done by JMeter and all aforementioned factors should be defined in Test plan.

JMeter test plan config
In case various libraries or variables are going to be used, they should be added in Test plan.
An important option in test plan is use of functional test mode. In this mode, the data relating to responses and samplers are saved which is a bit slower than usual mode from performance point of view.
More complete information regarding test plan can be found on these pages on apache website:


