Konstantine is the Head of QA department at ISS Art. He has over 25 years of experience in the field of IT and Quality Assurance. Konstantine is specialized in a variety of fields including load testing, functional and automated testing, security and other types of testing

Learn JMeter in 5 Hours

Start Learning
Slack

Run massively scalable performance tests on web, mobile, and APIs

Mar 09 2017

JMeter Listeners - part 4: Listeners that Support Scripting & Enable Test and System Management

Welcome to part 4 of our JMeter listeners series, which is also the final part. In part 1 we explained about listeners that have basic displays. In part 2 we went over listeners that aggregate data samples. In part 3 we covered listeners that calculate distribution metrics. This time, we will present listeners that support scripting and enable test and system management.

 

All listeners can be found by right clicking the test plan Add->Listeners. A JMeter Listener will only collect data from JMeter elements at or above its level. For a more detailed explanation see the first blog post in this series.

 

Listeners enable monitoring of JMeter requests, analyzing results and checking system health. They aggregate data, process and manipulate the information in it and even enable customization. Read on to learn about the 5 last listeners we will cover: BeanShell, JSR223, Composite Graph, PerfMon Metrics Collector and AutoStop.

 

BeanShell Listener

 

The BeanShell listener supports Java syntax code and has access to the JMeter runtime variables (vars, ctx, prev, log, props, SampleEvent) and to the methods they support. This enables you to get sample results and compose specific custom reports from them. Results are saved to a file.

 

In the screenshot below you can see an example of a BeanShell listener that implements writing aggregated information about response codes that each sampler of the script returns, to a file. The listener collects all the response codes from the samples in their scope into the Map java object. At the end of the script, in the TearDown thread group, the collected data is written into a file.

 

jmeter beanshell listener

 

JSR223 Listener

 

The JSR223 listener is similar to the BeanShell listener, but it enables selecting between several languages to code the listener functionality.

 

PerfMon Metrics Collector

 

Load testing measures not only the behavior of the tested system, but also its resource utilization. The PerfMon Metrics Collector listener receives CPU usage, memory consumption, disk and network utilization metrics and provides reports. The data is received from the server agent, which is installed on the servers of the system under the test. The server agent utility collects the resource consumption data of the servers it is installed on, and sends them back to the  listener. Learn more about the PerfMon Metrics Collector from this article: ‘How to monitor your server health and performance during the test’.

 

jmeter perfmon metrics collector

 

AutoStop Listener

 

One of the most useful JMeter listeners is the AutoStop listener, which is configured so that the test stops executing if the response time exceeds a certain value or if the error percentage rate is higher than the defined limit. After all, it makes sense to stop the test if the tested service is unresponsive. So if possible, we recommend you include this listener to the script.

 

jmeter autostop listener

 

Composite Graph Listener

 

Finally, there is one listener that can be used to consolidate all the information from other listeners configured in the script and display it on the chart. This is the Composite Graph listener, available through JMeter plugins. This listener is useful for finding the cause of bottlenecks or understanding the real capacity of the system under the test. For example, correlating response time charts and resource utilization charts or response time charts and throughput related charts.

 

composite graph listener

 

Please note that when running your tests in BlazeMeter, you should remove or disable the Listeners, unless you intend to generate extra log files. This is because they consume resources from the machine or engine that is running the test.

 

That’s it! We’ve covered all the important JMeter listeners. You can also view results, analyze KPIs and monitor system health through BlazeMeter reports.

 

If you want to learn more basic JMeter, check out our free 5-day training course.

 

For more advanced JMeter check out this free webinar.
 

To start testing for free with BlazeMeter, which enhances JMeter, put your URL or JMX file in the box at the top of this page and your test will start in minutes.

Interested in writing for our Blog?Send us a pitch!

Your email is required to complete the test. If you proceed, your test will be aborted.