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.

Tuesday, October 13, 2015

What kind of information can be saved into .jtl file when running JMeter with NON-GUI?


There are two ways we can use:

  •  modified the properties default values.  There are tons of  properties you can use to decide what you want to save into the result .jtl file. And you can find all of them from jmeter.properties file under /bin folder of your JMeter installation and they are starting with jmeter.save.saveservice.The following are default values.
#jmeter.save.saveservice.output_format=csv
#jmeter.save.saveservice.assertion_results_failure_message=false
#jmeter.save.saveservice.assertion_results=none
#jmeter.save.saveservice.data_type=true
#jmeter.save.saveservice.label=true
#jmeter.save.saveservice.response_code=true
#jmeter.save.saveservice.response_data=false
#jmeter.save.saveservice.response_data.on_error=false
#jmeter.save.saveservice.response_message=true
#jmeter.save.saveservice.successful=true
#jmeter.save.saveservice.thread_name=true
#jmeter.save.saveservice.time=true
#jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
#jmeter.save.saveservice.latency=true
#jmeter.save.saveservice.samplerData=false
#jmeter.save.saveservice.responseHeaders=false
#jmeter.save.saveservice.requestHeaders=false
#jmeter.save.saveservice.encoding=false
#jmeter.save.saveservice.bytes=true
#jmeter.save.saveservice.url=false
#jmeter.save.saveservice.filename=false
#jmeter.save.saveservice.hostname=false
#jmeter.save.saveservice.thread_counts=false
#jmeter.save.saveservice.sample_count=false
#jmeter.save.saveservice.idle_time=false
#jmeter.save.saveservice.timestamp_format=ms
#jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS
#jmeter.save.saveservice.default_delimiter=,
#jmeter.save.saveservice.default_delimiter=\t
#jmeter.save.saveservice.print_field_names=false
#jmeter.save.saveservice.xml_pi=<?xml-stylesheet type="text/xsl" href="../extras/jmeter-results-detail-report_21.xsl"?>
#jmeter.save.saveservice.base_prefix=~/
#jmeter.save.saveservice.autoflush=false

  •  We can use command-line option -D to change the jmeter.properties settings temporarily to make the test result save what we want to save into .jtl file.  for example, if we want to save the url into the .jtl, we can write the command line like this:

>>jmeter -n -t /my_jmeter_tests/testPath.jmx -l /my_jmeter_tests/test-output/test_result.jtl -D jmeter.save.saveservice.output_format=xml -D jmeter.save.saveservice.url=true

if we use -J, rather than -D, it will modify the proprieties's value permanently.

See Apache JMeter Properties Customization Guide for more details on what can be done using JMeter Properties.