是否可以在JMeter中获取CSV文件报告,只使用来自所有采样器的已定义的正则表达式变量值? 因为我在JMeter user.properties文件中定义了sample_variables。感谢。
答案 0 :(得分:2)
稍微难点 - 通过 user.properties 文件禁止所有JMeter默认结果保存配置,如:
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=false
jmeter.save.saveservice.label=false
jmeter.save.saveservice.response_code=false
jmeter.save.saveservice.response_data=false
jmeter.save.saveservice.response_data.on_error=false
jmeter.save.saveservice.response_message=false
jmeter.save.saveservice.successful=false
jmeter.save.saveservice.thread_name=false
jmeter.save.saveservice.time=false
jmeter.save.saveservice.subresults=false
jmeter.save.saveservice.assertions=false
jmeter.save.saveservice.latency=false
jmeter.save.saveservice.connect_time=false
jmeter.save.saveservice.samplerData=false
jmeter.save.saveservice.responseHeaders=false
jmeter.save.saveservice.requestHeaders=false
jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=false
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.print_field_names=false
最难:添加ie Beanshell Listener将变量值写入单独的文件。示例代码类似于:
import org.apache.commons.io.FileUtils;
FileUtils.writeStringToFile(new File("target_file.csv",vars.get("your_variable_name")));
有关使用脚本绕过JMeter限制的更多信息,请参阅How to Use BeanShell: JMeter's Favorite Built-in Component指南