24

I have been using JMeter in GUI mode for composing all the test cases required for load testing my service but for actual testing I need to execute tests in non-GUI mode. How do I save the results of Aggregate report in csv file using command-prompt.

Thanks in advance.

Harshdeep
  • 5,614
  • 10
  • 37
  • 45

5 Answers5

15

Just as alternative: you may do this directly from the Aggregate Report listener.

1. set filename/template for results file:

resultsFile = ${__property(user.dir)}${__BeanShell(File.separator,)}result_${__time(yyyyMMdd-HHmmss)}.csv

2. configure Aggregate Report listener as shown below:

enter image description here

CSV-file generated in this case will differ from generated via GUI/"Save Table Data" one.

If it is not acceptable you'll better use method with JMeterPluginsCMD from previous answer:

java -jar JMeterPluginsCMD.jar --generate-csv aggregateResults.csv --input-jtl testResults.jtl --plugin-type AggregateReport
Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
  • 9
    Your first answer (up to "If it is not acceptable...") does not make any sense - it is just writing tests results (like from _View Results Tree_) and have nothing in common with _Aggregate Report_ itself. – Konrad Kokosa Feb 02 '15 at 15:26
  • 1
    I used this command line tool but only got the following columns. 95%, 99% percentiles are missing. sampler_label,aggregate_report_count,average,aggregate_report_median,aggregate_report_90%_line,aggregate_report_min,aggregate_report_max,aggregate_report_error%,aggregate_report_rate,aggregate_report_bandwidth,aggregate_report_stddev – Makmeksum Jun 28 '16 at 05:01
  • 1
    @Makmeksam, you've got these columns in generated csv because they are predefined in plugin's source code. Looks like there is no configuration way to add percentiles or other sample params into csv (in contrast with Aggregate Report listener for which you can add 2nd and 3rd percentiles via user.properties file by setting additional properties: http://jmeter.apache.org/usermanual/component_reference.html#Aggregate_Report). – Aliaksandr Belik Jun 29 '16 at 15:30
  • 3
    @Makmeksam, here you can fin in separate branch updated source code of JMPlugins 1.4.0 release which will add both 95th & 99th percentiles to generated AggregateReport csv: https://github.com/aliesbelik/jmeter-plugins/tree/aggregate-upd. Or diff only: https://github.com/aliesbelik/jmeter-plugins/commit/a257c85f2ec0f9a9ae3b1e98af0df1fcfbd9f575#diff-6f6c237d32fcfb66d51138fd9020a3bb. You have to rebuild project and replace JMeterPlugins-Standard.jar in JMETER_HOME/lib/ext/. – Aliaksandr Belik Jun 29 '16 at 15:34
9

Use JMeterPluginsCMD tool with Plugin Type = AggregateReport

Community
  • 1
  • 1
Andrey Pokhilko
  • 2,578
  • 18
  • 19
6

1. Save result file

Specify a result file to saved into in View Results Tree or View Table Results (in CSV or XML). Ex: out/test-results.csv or with CLI argument -JTEST_RESULTS_FILE=out/test-results.csv

2. Convert to report

Convert the result file into an aggregate report:

$ java -jar CMDRunner.jar  --tool Reporter --generate-csv aggregateResults.csv --input-jtl out/test-results.csv --plugin-type AggregateReport

If you use brew, CMDRunner is located at:

/usr/local/Cellar/jmeter/2.13/libexec/lib/ext/CMDRunner.jar
Community
  • 1
  • 1
laffuste
  • 16,287
  • 8
  • 84
  • 91
  • BTW I ha to install an extra plugin because of what I read here https://groups.google.com/forum/#!topic/jmeter-plugins/Da4YN_nLvJA. BTW there is a cmd plugin runner in the jmeter bin folder to avoid calling the jar directly – guillem Sep 23 '17 at 09:10
1
  1. Download JMeterPluginsCMD.

  2. Move jmeter-plugins-manager-0.13.jar into /bin/libs/ext of your JMeter.

  3. Open JMeter, go to Options > Plugins Manager.
  4. Install the following plug-ins:
    • Synthesis Report
    • Command line graph plotting tool
  5. Run this command from your JMeter's /bin folder: ./JMeterPluginsCMD.sh --tool Reporter --generate-csv test.csv --input-jtl input.jtl --plugin-type AggregateReport
jamiee
  • 11
  • 1
0

With the help from the above answer, I wrote a simple bash script to automate the work of generating aggregated result .csv file using .jtl files

You can put this script in the folder where .jtl files are in , and just run the script in that directory. Then, it will put all the aggregated reports(.csv files) in the aggregate_report directory in the same directory

#! /usr/bin/env bash

echo "Generating reports..."
command_runner="/opt/apache-jmeter-2.13/lib/ext/CMDRunner.jar"
output="aggregate_report"
count=0

mkdir $output

for sample_file in *.jtl
do
        ((count++))
        filename="${sample_file%.*}"
        echo "Converting $filename"
        java -jar $command_runner --tool Reporter --generate-csv ${output}/${filename}.csv --input-jtl ${filename}.jtl --plugin-type AggregateReport
done

echo "$count files were converted."

note: change the command_runner variable accordingly with your CMDRunner.jar location

TMKasun
  • 784
  • 7
  • 24