Site icon Automation Dojos

Working with JMeter Listeners

About Listeners

Listeners are used for displaying test results in JMeter. Listeners allow system engineers to analyze the responses from the testing system and monetize the request sent from JMeter.

You can show the listener results in a table, tree, graph, or write into a file. These demonstrated effects consist of time details,capacity-related information, percentages, and distributions.

1. How to add a listener

Listeners can be placed by right-clicking on a thread group or a sample and clicking Add >> Listener >> the Listener you prefer to have. Plenty of listeners with different aspects have added to the Listeners menu. The required listener has selected the sample and the relevance of the data. These listeners collect data from their level or high level of its placement position.

I have created two thread groups in the above Test Plan. A “View Results Tree Listener” has been placed in three different positions in the Test Plan. “View Results Tree 1”  Listener has is added as a child element of the “FTP Request Post” sample. So it will only display the results of its parent sample.“View Results Tree 2”  listener has placed under the” Thread Group.” So it will present results of all samplers in “Thread Group.” “View Results Tree 3” listener will show the results of all samplers in both “Thread Group ” and “New Thread Group.” Following is how a listener shows results based on its position.

2. Basic listeners for viewing results

I have created an HTTP Request Sampler to demonstrate the listeners below. I have used the Apache JMeter User Manual page to test the listeners, and you can find it from this link. The image below shows the settings of the HTTP Request Sampler. Also, I have to change the Thread Group properties for ten users. Use the path mentioned above to add.

2.1) View Results in Table Listener

This listener displays the data in the form of a table. The ten users obtain the following results. These results are in order of the time samples that were issued. Below is a useful listener to estimate a system under test quickly. Let’s understand the outputs from this listener.

“Sample” is the number of the sample of 10 samples that we have used. Then the start time and the Thread Name are displayed. 1-1 in that indicates the first iteration of example 1. “Label” shows the type of request we have used. “Sample Time” is the response time for each sample in milliseconds. “Status” is displayed based on the assertion we use. If the claim passes, it shows in green, and if it fails, it shows in red. “Sent Bytes” are the size of our sample. “Latency” means the time that takes to receive a response from the start time. “Connect time” is the time that seeks to connect to the server.

2.2) View Results Tree Listener

This listener displays the samples and the results related to them. It displays request parameters, response parameters, and response data of the samples. ”Sampler Result” section also shows the data discussed in the above listener. In addition to that, it displays “Error count,” Data type,” Response Message,” Content-Type” data.

“Request” shows the Get request to the server for receiving the information.

Response data shows the data received from the server. In this case, it is an HTML code of the web page.

2.3) Graph Results Listener

This listener generates the results in the form of a graph. It can give the Average, Median, Deviation, and Throughput data of the samples in a graphical view.“ Loop Count” property of the Thread Group should be set to infinite to get a continuous graph. The following listener is highly memory-consuming. So if you are testing a massive load test, it is better to get your results into a file.

2.4) Save Responses to a File Listener

You can see a field called Filename in all these listeners. So you can give a “.CSV” or. “XML” file to save these data from the listeners in the runtime to that file. Give the path of that file in the desired location to the “Filename” field and run it. I have given a file as “Logged Data” for View results tree Listener,” and it has saved all the response data as in the below. “CSV” file.this is a beneficial way to observe test results when you are testing large systems.

These are the most used listeners in JMeter, and you can try them to see their performance according to your test plans.

Exit mobile version