2

I need to take the Summary Report Listener and customize it so that I can add an additional column to display latency for each record of the output. It can be implemented as a custom plugin as well. What I want is a listener with all the columns of Summary Report plus the Latency column.

IAmMilinPatel
  • 413
  • 1
  • 11
  • 19

1 Answers1

2

If you really have to "take the Summary Report Listener and customize it", then you will have to go the hard way:

  1. First, setup a Java project. For example if using Maven, it's your typical setup with one additional dependency

  2. Unfortunately the way SummaryReport is implemented, it does not allow any flexibility around data columns. So you have to duplicate SummaryReport and add what you need into your version. Or implement your own separate "visualizer" just for that one latency value, based on AbstractVisualizer (in which case use SummaryReport as an example on how to do it).

  3. Then you build your plug-in into jar, drop it into jmeter_dir/lib/ext, and drop all of its missing dependencies into jmeter_dir/lib (if building with Maven, it's easier to create zip that contains your jar and all dependencies

And if everything is fine, you will get what you want.

However if it's acceptable for you to NOT use Summary Report for latency, a much easier solution is to add one of the programmable listeners (i.e. BSF listener or JSR223 Listener) to your test plan. It has access to sampleResult object. So you can develop a small function that would save the latency into the file. Something like this (using BSF with "java" selected for language):

 String filename = "/tmp/latency_report";
 FileOutputStream f = new FileOutputStream(filename, true);
 PrintStream p = new PrintStream(f); 
 this.interpreter.setOut(p); 
 print(prev.getEndTime() + "," + prev.getLatency());
 f.close();

Note that this example shows the most primitive implementation (i.e. it opens file each time, not really safe for multi-threading, no error handling).

Community
  • 1
  • 1
timbre timbre
  • 12,648
  • 10
  • 46
  • 77
  • This can be a somewhat useful hint, but what I'm looking for is a way to create a custom listener plugin where I can get all the data as in Summary Report + Latency. – IAmMilinPatel Jan 20 '16 at 03:58