Jmeter-命令行执行压测

1.切到jmeter的bin目录

Microsoft Windows [版本 10.0.16299.194]
(c) 2017 Microsoft Corporation。保留所有权利。
C:\Users\lixxx>cd C:\apache-jmeter-4.0\bin

2.执行
jmeter.bat -n -t C:\apache-jmeter-4.0\bin\baidu.jmx -l C:\Users\liuxxxn\Desktop\output\logfile.jtl
-n是指nongui,非界面模式
-t后面是脚本的路径
-l后面是压测生成的数据保存的路径,logfile.jtl不用创建,只要创建output这个文件夹即可,如果脚本被多次执行,那么再次执行脚本前,要删除已经存在的logfile.jtl文件
C:\Users\liuxxxan>cd C:\apache-jmeter-4.0\bin

C:\apache-jmeter-4.0\bin>jmeter.bat -n -t C:\apache-jmeter-4.0\bin\baidu.jmx -l C:\Users\lixxx\Desktop\output\logfile.jtl
May 08, 2019 5:39:48 PM java.util.prefs.WindowsPreferences 
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Creating summariser 
Created the tree successfully using C:\apache-jmeter-4.0\bin\baidu.jmx
Starting the test @ Wed May 08 17:39:48 CST 2019 (1557308388358)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary +   3470 in 00:00:11 =  308.8/s Avg:    42 Min:    24 Max:   642 Err:     0 (0.00%) Active: 28 Started: 28 Finished: 0
summary +  21928 in 00:00:30 =  731.0/s Avg:    63 Min:    24 Max:  1163 Err:     0 (0.00%) Active: 50 Started: 50 Finished: 0
summary =  25398 in 00:00:41 =  615.9/s Avg:    60 Min:    24 Max:  1163 Err:     0 (0.00%)
summary +  23324 in 00:00:30 =  777.4/s Avg:    64 Min:    24 Max:  2212 Err:     0 (0.00%) Active: 50 Started: 50 Finished: 0
summary =  48722 in 00:01:11 =  683.9/s Avg:    62 Min:    24 Max:  2212 Err:     0 (0.00%)
summary +  21781 in 00:00:30 =  725.9/s Avg:    52 Min:    23 Max:  1566 Err:     0 (0.00%) Active: 15 Started: 50 Finished: 35
summary =  70503 in 00:01:41 =  696.4/s Avg:    59 Min:    23 Max:  2212 Err:     0 (0.00%)
summary +   2208 in 00:00:09 =  250.5/s Avg:    31 Min:    23 Max:   261 Err:     0 (0.00%) Active: 0 Started: 50 Finished: 50
summary =  72711 in 00:01:50 =  660.7/s Avg:    58 Min:    23 Max:  2212 Err:     0 (0.00%)
Tidying up ...    @ Wed May 08 17:41:38 CST 2019 (1557308498823)
... end of run
C:\apache-jmeter-4.0\bin>

GUI模式下,打开监听器,查看监听结果
Jmeter-命令行执行压测_第1张图片

Jmeter-命令行执行压测_第2张图片

Jmeter-命令行执行压测_第3张图片
服务器硬件性能没有正确显示,少量压测时建议用GUI模式压测,分别将监听器的数据保存到单独的文件中
Jmeter-命令行执行压测_第4张图片

你可能感兴趣的:(Jmeter)