Tuesday, August 6, 2013

Performance Test Reports - JMeter Listeners Tutorial

I run a training course on Apache JMeter called Web Performance Testing with JMeter. One of the important concepts in JMeter is Listeners and that I want to share with you. Reports are called Listeners in JMeter vocabulary. Listeners are used to collect the performance test results and display it to the performance tester. Now, let us learn about Listeners in JMeter and how to use them. You can see listeners working in my short JMeter video.

Listeners are used to collect and display performance test results. But there are many types of Listeners. One of my favorites is View Results in Table. It is a simple Listener that shows data about each response. Here is what it looks like.


In the above Listener, the Sample Time (ms) indicates the Response Time, the Status indicates if the request was successful (green means yes, orange means no), the Bytes indicate the size of the response and the Latency indicates the Latency Time. Of course, you can copy the test results to Microsoft Excel and format them further. But, there is an easier option. You can have JMeter save the test results to a CSV file or XML file. Further, you can even specify which fields you want to save by clicking the Configure button. JMeter can also summarize the test results automatically for you. For this, you can use Summary Report. Here is what it looks like. It summarizes the results for each request. 


JMeter has Listeners that automatically show the test results graphically. There are several like Spline Visualizer and Distribution Graph but my favorite is Graph Results. Here is what it looks like. It shows the Average and Median Response Time and the Throughput.


Some other points to note are:
1. All Listeners have access to the same test results. Only their display is different.
2. As with other test elements, Listeners work according to their scope. This means that if you put a Listener under the Test Plan, it will capture and show all the test results. If you put the Listener a request, it will capture and show test results of that request only.
3. In a particular scope, Listeners are last in execution order because they need all the results as input.
4. Listeners use substantial CPU and RAM resources on the computer. In order to avoid the Listeners becoming a bottleneck, you should decide the best Listener for your purpose and put just that Listener in your Test Plan.

Overall, JMeter Listeners are basic but configurable and very simple to use. You can save effort on test results reporting by using these available Listeners.