Headless JMeter - 如何在输出文件中打印响应数据 [英] Headless JMeter -How to get printed the response data in the output file
问题描述
我在非 gui 模式下使用 jmeter 脚本运行负载测试.
I am running a load test by using a jmeter script in non gui mode.
我使用以下命令在非 gui 模式下运行 JMeter 并将结果存储在文件 Test.jtl 中
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
写入 Test.jtl 的示例数据如下所示,它不打印响应数据.有没有办法通过更改 jmeter 脚本或上面的命令来打印响应数据?
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?
任何帮助将不胜感激.
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
谢谢
推荐答案
默认情况下,JMeter 不会将响应数据存储为:
By default JMeter does not store response data as:
- 由于高磁盘 IO 增加了执行开销
- .jtl 文件的大小大大增加
- 以默认格式(即 CSV)存储响应数据是不可能的,因为响应数据肯定至少有一个分隔符
您仍然可以配置 JMeter 来存储响应数据,但请记住以上限制.为此,请传递以下额外的命令行参数:
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
另一个选项是将接下来的 2 行添加到 user.properties 文件(位于 JMeter 安装的/bin 文件夹中)
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
请参阅 Apache JMeter 属性自定义指南,了解有关 JMeter 属性和方法的更多信息与他们合作
See Apache JMeter Properties Customization Guide for more information on JMeter properties and ways of working with them
这篇关于Headless JMeter - 如何在输出文件中打印响应数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!