Jmeter运行的方式
1、GUI方式运行
特点:主要可能是消耗太多的性能,导致测试机负载变少,比如正常一个GUI可以产生100并发,但是如果是非GU模式,可以达到120。
运行方式:简单,在这里就不做多介绍
2、非GUI方式运行(即命令行模式)
2.1运行命令(无日志报告)
- 无日志-格式
jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]
- 使用:
jmeter -n -t 非GUI执行脚本.jmx -l testlog.jtl -e -o ./report
- 参数解析:
| 名称 | 解析 |
|–|--|
| -n | 非GUI形式运行 |
| -t | 指定脚本的路径(相对或绝对) |
| -l| 记录测试结果到文件(相对或绝对),必须不存在 |
| -e| 在脚本运行结束后生成hmtl报告 |
| -o| 保存html报告的位置,必须不存在 |
2.2运行命令(有日志报告)
- 有日志-格式
jmeter -g <log file> -o <Path to output folder>
- 使用
jmeter -g testlog.jtl -o ./report
2.3更多命令见帮助
C:\Users\LGY\Desktop\jmeter>jmeter --help
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \
/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |
/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 5.1.1 r1855137
Copyright (c) 1999-2019 The Apache Software Foundation
To list all command line options, open a command prompt and type:
jmeter.bat(Windows)/jmeter.sh(Linux) -?
--------------------------------------------------
To run Apache JMeter in GUI mode, open a command prompt and type:
jmeter.bat(Windows)/jmeter.sh(Linux) [-p property-file]
--------------------------------------------------
To run Apache JMeter in NON_GUI mode:
Open a command prompt (or Unix shell) and type:
jmeter.bat(Windows)/jmeter.sh(Linux) -n -t test-file [-p property-file] [-l results-file] [-j log-file]
--------------------------------------------------
To run Apache JMeter in NON_GUI mode and generate a report at end :
Open a command prompt (or Unix shell) and type:
jmeter.bat(Windows)/jmeter.sh(Linux) -n -t test-file [-p property-file] [-l results-file] [-j log-file] -e -o [Path to output folder]
--------------------------------------------------
To generate a Report from existing CSV file:
Open a command prompt (or Unix shell) and type:
jmeter.bat(Windows)/jmeter.sh(Linux) -g [csv results file] -o [path to output folder (empty or not existing)]
--------------------------------------------------
To tell Apache JMeter to use a proxy server:
Open a command prompt and type:
jmeter.bat(Windows)/jmeter.sh(Linux) -H [your.proxy.server] -P [your proxy server port]
---------------------------------------------------
To run Apache JMeter in server mode:
Open a command prompt and type:
jmeter-server.bat(Windows)/jmeter-server(Linux)
来源:CSDN
作者:小友~
链接:https://blog.csdn.net/baidu_39372836/article/details/99454781