Categories
Automation

Separate Your JMeter Testing and Reporting

One of the common practices I have seen from people using JMeter is that of putting lots of listeners in their performance tests. There are a few good reasons to avoid this practice.

  • JMeter uses up resources to display the listeners
  • You repeat your listeners in many of your tests
  • It makes your test plan harder to read (listener noise)
  • You can’t see your listeners if you are running from the command line

The first of these reasons is pretty well known. If you are pushing your machines to generate a lot of load, you don’t want to spend CPU cycles and oodles of memory on the analysis. You definitely don’t want the analysis to impact the results either.

You especially don’t want listeners in your test plan that are hungry, i.e. anything that creates graphs or keeps lists of all the requests and responses (like the results tree, results table, graph results, or anything else with pictures on!)

So here is the simple way to solve all of these problems.

Add a single listener in each of the performance test plans that logs the data to a file. The summary report listener will be sufficient for our needs. Configure your listener as follows…

JMeter Logging Configuration

The option highlighted in red “Save Response Data (XML)” is best avoided as you’ll end up with a massive file.

Now create a second JMeter project and add all the listeners that you use regularly. In the example below, I have left all of the default names to show the ones I’m using a lot right now – but you can choose the ones that answer the questions you have on performance.

JMeter Listener Project

Now you can run your performance tests (via the UI or command line) and it will generate a file containing the results. You can then open the file to display in the listeners in your listener project and see the results independently of the actual runs.

This also means you can treat the log files generated by your continuous integration builds in the same way if you want to perform additional analysis. The example below shows the all important “Browse” button that allows you to load a file, which will then cause the graph to be drawn.

JMeter Graph Results