Friday, December 11, 2015

Collect Jmeter test result with CSV format



in the command line or batch file, you need to modify the Default Configuration settings.  

for example: if you want your result looks like this: 
this csv file includes: timestamp, elapsed time, label, response code, bytes, SampleCount, ErrorCount,  your command should like this:

Start C:\apps\apache-jmeter-2.13\bin\jmeter.bat -n -t C:\testPath.jmx -l C:\test-output\Report_20151211_A.csv -Jjmeter.save.saveservice.output_format=csv -Jjmeter.save.saveservice.print_field_names=true -Jjmeter.save.saveservice.sample_count=true -Jjmeter.save.saveservice.data_type=false -Jjmeter.save.saveservice.timestamp_format="yyyy/MM/dd HH:mm:ss.SSS" -Jjmeter.save.saveservice.latency=false -Jjmeter.save.saveservice.successful=false -Jjmeter.save.saveservice.response_message=false -Jjmeter.save.saveservice.thread_name=false -Jjmeter.save.saveservice.thread_counts=false

if you want your results showing like this:
the command should like this:
Start C:\apache-jmeter-2.9\bin\jmeter.bat -n -t C:\testPath.jmx -l C:\test-output\Report_20151211_A.csv -Jjmeter.save.saveservice.output_format=csv -Jjmeter.save.saveservice.print_field_names=true -Jjmeter.save.saveservice.url=true -Jjmeter.save.saveservice.thread_counts=true -Jjmeter.save.saveservice.sample_count=true -Jjmeter.save.saveservice.hostname=true -Jjmeter.save.saveservice.data_type=false -Jjmeter.save.saveservice.response_data.on_error=true --Jjmeter.save.saveservice.timestamp_format="yyyy/MM/dd HH:mm:ss.SSS"
 

How to merge multiple csv files into one csv file?

  •  Move all of the CSV files into one folder and there is no other unnecessary csv files
  • Open the cmd window and using cd to get to the folders with all the csv files that you want to be merged.
  • Writing command like this : 
            copy *.csv baseline_20151211.cvs


  • The new csv file is generated.

d




  • Note:  if every csv file has headers, all of the headers will be copied into the new files, so avoid this, before you do the merge job, please remove the headers from the csv file and only leave the headers in the first csv file. 
  • NOTE: for the merged file, sometimes can’t be open correctly by the Excel. So we need to do another thing before merge. Open one of the csv file in notepad or other file editor, added one line like this:                                      Sep=,


After doing this, the new merged csv file will open in the Excel file correctly.