JMeter Listener Types | Part 1
JMeter Listener Types | Part 1
One of the most important things to perform a successful performance test is to analyze and investigate the server status and responses. And on JMeter, you should definitely use JMeter listener to achieve this. Luckily, JMeter offers a wide variety of listeners.
JMeter listeners give you an efficient display of data that JMeter collects from requests, responses, time-related metrics, etc. With this data, performance test engineers and other IT employees can have detailed insights into the system under test. JMeter offers around 20 listeners and each of them is crucial for your test effort. And one of the biggest advantages of these listeners is that they are really easy to use.
Note that listeners below may change according to the JMeter version you use. Some older versions don’t support new listeners and some new versions stopped supporting other JMeter listeners. You can find all available versions here.
Where to Place Them?
You can find listeners by following Add->Listeners path on JMeter. Listeners can be placed anywhere, but doing so will change the outcome of these listeners. A listener will only collect and display data from JMeter elements at or above its level. If you add a JMeter listener as a child element, it will only collect data from its parent element. And if you add it under a thread group -and even under thread groups- that listener will display the data of all the samples that belong to that thread group(s).
So placing your JMeter listener is also another important aspect of using them. If you want to use them for all your requests, don’t put listeners for each request. Just be wise to know where to place them as an example of best practice.
Now that we know where and how to place JMeter listeners, let’s start getting to know them!
Basic JMeter Listeners
And in this section, we will be dealing with basic listeners; they collect and display data without making any complicated manipulations.
View Results Tree
One of the most popular listeners of JMeter. It displays all the samplers under your test plan and all related assertions. It orders samplers as they are ordered in your test plan. With View Results Tree, you can see the custom-header and body parts of requests and also some metrics for each request. And by changing displaying / rendering type (For example CSS Tester, JSON Tester, RegExp Tester) you can manipulate the data provided by the response body.
As we said above, View Results Tree can show information about assertions as well. But it won’t be showing any successful assertions, only the failed ones. For failed assertions, it compares expected and actual results. With this feature, you can exactly understand what went wrong and what triggered this failed assertion.
View Results in Table
It is a bit similar to the View Results Tree listener. The biggest difference is; that it displays the information of each sampler/request in the form of a table. You can see information like sample number, thread number, execution result, and time-related data like latency, connect time, sample time, etc. It is a very useful and quick way to understand the performance of your system under test.
Actually, it’s an outdated listener and you won’t be able to find it if your JMeter version is higher than 2.13. Spline Visualizer draws a graph to show the response times of the system under test. First, it divides all samplers into ten groups, calculates their average response time, and provides a graph.
If you configure this JMeter listener for all the script samplers, it will display the responsiveness of the system under test. But if you configure it as a child element of a specific sampler, this JMeter listener will show how the response time related to the sampler changes over time.
Response Time Graph
Another sampler provides you with a graph for response times. It can provide you with a graph for each sampler or you can draw only one graph for all the samplers. Another useful way for tracking the response times of your samplers is to see if any kind of bottleneck occurs during your testing session.
An Assertion Results listener displays the results of all assertions in its scope. Passed assertions won’t be seen there. Only the failed assertions will be shown for you to analyze them.
this is the first part of our basic listeners. They are cool, aren’t they? And also, very useful. But, there’s an important problem with them. As they are collecting lots of information and data to give you an insight about the system under test, they are a bit resource-consuming elements. And if you use lots of them, the performance of your test (not the system under test) and JMeter can get harmed. To prevent this from happening, you can write the data to a file.
To achieve this, JMeter also offers some data writing listeners. They can write the data to a specific file or directly to the JMeter log. They can be saved as XML or CSV files. When they are used, data won’t be displayed in tables and graphs, so you’ll be saving some performance for JMeter and your system.
Simple Data Writer
Simple Data Writer writes results to the filename provided by the user. The content of the data that will be written into the file can be determined from jmeter.properties file, which is located in the /bin folder of JMeter. And again, the format of the output file can be determined from jmeter.properties file.
Flexible File Writer
Similar to Simple Data Writer but a more flexible version of it, just like the name. Flexible File Writer allows you to decide which sample data to print out to the file while you are configuring the custom-header and footer parts.
Save Responses to a File
It saves information for each specific response to separate files and then indexes them. So, you should be aware that the output of this JMeter listener can be multiple files.
Comparison Assertion Visualizer
The Comparison Assertion Visualizer listener shows the results of any Compare Assertion elements. With this listener, you can compare different assertion results.
Enjoyed this article? Check out Loadium for more!