非GUI模式运行命令解释
命令参数 | 英文解释 | 中文解释 |
-n | This specifies JMeter is to run in non-gui mode | 这指定JMeter在非gui模式下运行 |
-t | [name of JMX file that contains the Test Plan]. | 指定jmx脚本路径 参数为:jmx脚本路径,若脚本非当前目录需用全路径或相对路径。 |
-l | [name of JTL file to log sample results to] |
[记录样本结果的JTL文件名] 路径不存在,会自动创建 自定义结果文件后缀可以".jtl"/".csv"结尾 |
-j | [name of JMeter run log file]. |
[JMeter运行日志文件的名称]。 路径不存在,会自动创建 |
-r | Run the test in the servers specified by the JMeter property "remote_hosts" | 在JMeter属性“remote_hosts”指定的服务器中运行测试 |
-R | [list of remote servers] Run the test in the specified remote servers | [远程服务器列表]在指定的远程服务器中运行测试 |
-g | [path to CSV file] generate report dashboard only | [CSV文件路径]仅生成报告仪表板 |
-e | generate report dashboard after load test | 负载测试后生成报告仪表板 |
-o |
output folder where to generate the report dashboard after load test. Folder must not exist or be empty The script also lets you specify the optional firewall/proxy server information: |
负载测试后用于生成报告仪表板的输出文件夹。文件夹不能存在或为空 |
-h | [proxy server hostname or ip address] | 指定[代理服务器主机名或ip地址] |
-P | [proxy server port] | [代理服务器端口] |
注意:以下执行位置处于运行脚本当前目录,所以在运行时没有加上路径
1.执行测试脚本
jmeter -n -t “脚本路径+脚本名称全称” -l “报告路径+自定义报告名称全称”
jmeter -n -t new_weice_loginhtml_1.jmx -l resut.jtl
默认日志存储于jmeter/bin/jmeter.log文件中
2.执行测试脚本指定日志存储文件
jmeter -n -t “脚本路径+脚本名称全称” -l “报告路径+自定义报告名称全称” -j "日志路径+日志文件全称“
jmeter -n -t new_weice_loginhtml_1.jmx -l resut.jtl -j resurt_2.log
3.分布式远程执行默认服务器列表(-r:表示默认jmeter.perportes文件中配置的全部远程执行机)
jmeter -n -t “脚本路径+脚本名称全称” -r -l “报告路径+自定义报告名称全称” -j "日志路径+日志文件全称“
jmeter -n -t new_weice_loginhtml_2.jmx -r -l distrabuted.csv -j 20220217.log
4.分布式指定服务器执行,如果指定多台执行机,执行命令中用英文逗号","隔开
jmeter -n -t “脚本路径+脚本名称全称” -R "IP1:port1,IP2:port2" -l “报告路径+自定义报告名称全称” -j "日志路径+日志文件全称“
jmeter -n -t new_weice_loginhtml_2.jmx -R 10.2.7.108:1099 -l distrabuted.csv -j 20220217.log
更多命令解释请参考官网:https://jmeter.apache.org/usermanual/get-started.html
欢迎驻足,属个人总结,若有不妥之处,敬请指出,为谢!!