-->

Headless JMeter -How to get printed the response d

2019-04-01 04:57发布

问题:

I am running a load test by using a jmeter script in non gui mode.

I use the following command to run the JMeter in non gui mode and result is stored in a file Test.jtl

sh jmeter.sh -n -t ThreadGroup.jmx -l Test.jtl

Sample data written to Test.jtl is as below and there it does not print response data. Is there a way to get printed the response data as well may be by altering jmeter script or above command?

Any help would be appreciated.

1453272193899,231,HTTP Request-staging-qqq-customer1,200,OK,Thread Group two 1-6,text,true,466,231
1453272193927,227,HTTP Request-staging-TT2-customer1,503,Service Unavailable,Thread Group two 1-1,text,false,751,227
1453272193963,222,HTTP Request-staging-TT2-customer1,503,Service Unavailable,Thread Group two 1-2,text,false,604,222
1453272194026,238,HTTP Request-staging-TT1-customer1,200,OK,Thread Group two 1-3,text,true,448,238
1453272194131,233,HTTP Request-staging-qqq-customer2,200,OK,Thread Group two 1-6,text,true,466,233

Thanks

回答1:

By default JMeter does not store response data as:

  1. It increases execution overhead due to high disk IO
  2. The size of .jtl file is greatly increased
  3. Storing response data in default format (which is CSV) is not possible as response data will definitely have at least one delimiter character

You can still configure JMeter to store response data, but keep in mind above constraints. In order to do so pass the following extra command line arguments:

sh jmeter.sh -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true -n -t ThreadGroup.jmx -l Test.jtl

another option is adding next 2 lines to user.properties file (located in /bin folder of your JMeter installation)

jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true

See Apache JMeter Properties Customization Guide for more information on JMeter properties and ways of working with them



回答2:

The response data will be recorded in your JTL, if you check "Save as XML" and "Save Response Data XML" instead of CSV file in your Sample Result Save Configuration.