1
votes

Currently I'm struggling with getting desirable JMeter reports from java code. My goal is to get latency and throughput logged into file for each transaction and then have a summary per each scenario with averages and max/min values for latency and throughput.

Currently I have this code for reports:

ResultCollector csvlogger = new ResultCollector(summer);
csvlogger.setFilename(csvLogFile);
testPlanTree.add(testPlanTree.getArray()[0], csvlogger);

But in this way it logs info only per one transaction and there is no throughput, and latency reported is simply 0 (without any decimal part). It looks like this:

timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect
2017/06/28 08:53:49.276,1014,Jedis Sampler,200,OK,Jedis Thread Group 1-1,text,true,,0,0,1,1,0,0,0

Does anyone know is there any way how I can tune it?

Thanks!

1

1 Answers

0
votes
  • only per one transaction - .jtl log file contains execution of single sampler, try adding more threads and/or loops on Thread Group level and you should see more results.
  • Latency always zero for scripting-based samplers, you need to explicitly call SampleResult.setLatency() method and set the desired value.
  • Throughput is not being recorded, it is being calculated. You need to open .jtl results file with i.e. Aggregate Report or Summary Report listener to see the generated value. Take a look into org.apache.jmeter.util.Calculator class source to see the details if you prefer programmaticall non-GUI approaches.