下载
官网下载地址: Apache JMeter - Download Apache JMeterhttps://jmeter.apache.org/download_jmeter.cgi
可以根据需要直接下载二进制文件
前提条件
需要安装 java环境 java8+
windows 安装配置
- 下载 .zip 格式的二进制文件后解压到一个只有英文路径的目录下;
- 配置环境变量:
# 添加 JMETER_HOME 变量 D:\softinstalllocation\apache-jmeter-5.2.1\apache-jmeter-5.2.1 # Path内添加变量 %JMETER_HOME%\bin # CLASS_PATH 内添加变量 %JMETER_HOME\lib\ext\ApacheJMeter_core.jar;%JMETER_HOME%\lib\jorphan.jar;%JMETER_HOME%\lib\logkit-2.0.jar
- 将 JMETER_HOME/bin 目录下的Jmeter.bat 或者 Jmeter.sh 发送到桌面快捷方式 即可使用
unix 安装配置
- 将下载后的tar.gz 包解压到 /usr/local/jmeter 目录
- 配置环境变量 vim /etc/profile 输入 i 将下面配置复制
# JAVA 环境变量 export JAVA_HOME=/usr/local/java/jdk1.8.0_231 export JRE_HOME=/usr/local/java/jdk1.8.0_231/jre # jmeter 解压目录 export JMETER_HOME=/opt/jmeter/apache-jmeter-5.2.1 # 配置 CLASS_PATH export CLASS_PATH=$CLASS_PATH:$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$JMETER_HOME/lib/logkit-2.0.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib # 配置 PATH export PATH=$PATH:$JMETER_HOME/bin:$JRE_HOME/bin:$JAVA_HOME/bin
-
按下 esc 输入 : 输入 wq 回车 保存退出
-
使配置生效:source /etc/profil
jmeter如何运行:
D:\my_git\Jmeter_learn>jmeter --help # 查看帮助信息
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \
/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |
/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 5.2.1
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:
# 将csv格式的测试结果文件生产测试报告
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 服务端程序
jmeter-server.bat(Windows)/jmeter-server(Linux)
---------------------------------------------------