1、首先需要准备好 .jmx 脚本
2、修改jmeter.properties文件(把注解去掉,报告中才能展示所需信息)
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.assertion_results_failure_message=true
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
# Only available with HttpClient4
jmeter.save.saveservice.connect_time=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.responseHeaders=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
# Only available with HttpClient4
jmeter.save.saveservice.sent_bytes=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.filename=true
jmeter.save.saveservice.hostname=true
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=true
jmeter.save.saveservice.idle_time=true
jmeter.save.saveservice.timestamp_format=ms
jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS
sampleresult.timestamp.start=true
3、打开cmd 命令窗口
输入下面的命令:
jmeter -n -t E:/jmeterData/jmeter_Script/hszspay.jmx -l result.jtl -e -o E:/jmeterData/jmeter_Script/result
-n :以非GUI形式运行Jmeter
-t :hszspay.jmx 脚本路径
-l :运行结果保存路径(.jtl),此文件必须不存在
-e :在脚本运行结束后生成html报告
-o :保存html报告的地址, 此文件必须不存在