1.说明
jmeter
是apache
公司推出的接口压测工具。基于java
开发,使用时候需要电脑安装jdk
。当前环境jmeter5.1.1 +jdk1.8+mac
系统,
官网:https://jmeter.apache.org/index.html

2、安装
mac
下jmeter
安装非常简单,只需要下载apache对应的压缩包,解压即可。
2.1 下载

jmeter文件存放位置:
/Users/lxxxyang/Documents/tools/apache-jmeter-5.1.1
2.2 修改配置文件jmeter.properties
主要是设置汉化语言,配置文件目录 /bin/jmeter.properties
# JMeter properties are described in the file
# http://jmeter.apache.org/usermanual/properties_reference.html
# A local copy can be found in
# printable_docs/usermanual/properties_reference.html
#Preferred GUI language. Comment out to use the JVM default locale's language.
#language=en
language=zh_CN
# Additional locale(s) to add to the displayed list.
# The current default list is: en, fr, de, no, es, tr, ja, zh_CN, zh_TW, pl, pt_BR
# [see JMeterMenuBar#makeLanguageMenu()]
# The entries are a comma-separated list of language names
#locales.add=zu
2.3 运行
- 打开终端,切换到
/bin
目录
/Users/lxxyang/Documents/tools/apache-jmeter-5.1.1/bin
-
找到mac下运行文件jmeter
image.png
- 运行文件:sh jmeter
[longshiyang@lsyPro bin ]$ sh jmeter
================================================================================
Don't use GUI mode for load testing !, only for Test creation and Test debugging.
For load testing, use CLI Mode (was NON GUI):
jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]
& increase Java Heap to meet your test requirements:
Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m" in the jmeter batch file
Check : https://jmeter.apache.org/usermanual/best-practices.html
================================================================================
-
打开Jmeter界面如下图(已经是汉化版)
image.png
3. 使用实战
3.1 新增线程组
右键测试计划-->添加-->线程(用户)-->线程组
配置线程组信息如下:

3.2 配置http请求

http请求配置内容

3.3 配置察看结果树

3.4 配置聚合报告

3.5 运行jmeter

3.6 查看聚合报告

参考:
https://blog.csdn.net/moshenglv/article/details/54390285
https://blog.csdn.net/aa390481978/article/details/108142460
https://blog.csdn.net/aa390481978/article/details/108101618
网友评论