md_files/自学/Jmeter快速入门.md

118 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Jmeter快速入门
# 1.安装Jmeter
Jmeter依赖于JDK所以必须确保当前计算机上已经安装了JDK并且配置了环境变量。
## 1.1.下载
可以Apache Jmeter官网下载地址http://jmeter.apache.org/download_jmeter.cgi
![image-20210715193149837](https://pic.bitday.top/i/2025/05/26/tznfpu-0.png)
## 1.2.解压
因为下载的是zip包解压缩即可使用目录结构如下
![image-20210715193334367](https://pic.bitday.top/i/2025/05/26/u06lfv-0.png)
其中的bin目录就是执行的脚本其中包含启动脚本
![image-20210715193414601](https://pic.bitday.top/i/2025/05/26/u05ks0-0.png)
### 1.3.运行
双击即可运行,但是有两点注意:
- 启动速度比较慢,要耐心等待
- 启动后黑窗口不能关闭否则Jmeter也跟着关闭了
![image-20210715193730096](https://pic.bitday.top/i/2025/05/26/u0587p-0.png)
# 2.快速入门
## 2.1.设置中文语言
默认Jmeter的语言是英文需要设置
![image-20210715193838719](https://pic.bitday.top/i/2025/05/26/u04iub-0.png)
效果:
![image-20210715193914039](https://pic.bitday.top/i/2025/05/26/u03mqn-0.png)
> **注意**上面的配置只能保证本次运行是中文如果要永久中文需要修改Jmeter的配置文件
打开jmeter文件夹在bin目录中找到 **jmeter.properties**,添加下面配置:
```properties
language=zh_CN
```
![image-20210715194137982](assets/image-20210715194137982.png)
> 注意:前面不要出现##代表注释,另外这里是下划线,不是中划线
## 2.2.基本用法
在测试计划上点鼠标右键,选择添加 > 线程(用户) > 线程组:
![image-20210715194413178](https://pic.bitday.top/i/2025/05/26/u02imb-0.png)
在新增的线程组中,填写线程信息:
![image-20210715195053807](https://pic.bitday.top/i/2025/05/26/u01yeh-0.png)
给线程组点鼠标右键添加http取样器
![image-20210715195144130](https://pic.bitday.top/i/2025/05/26/u01btr-0.png)
编写取样器内容:
![image-20210715195410764](https://pic.bitday.top/i/2025/05/26/u00hs4-0.png)
添加监听报告:
![image-20210715195844978](https://pic.bitday.top/i/2025/05/26/tzraz5-0.png)
添加监听结果树:
![image-20210715200155537](https://pic.bitday.top/i/2025/05/26/tzqini-0.png)
汇总报告结果:
![image-20210715200243194](https://pic.bitday.top/i/2025/05/26/tzpp58-0.png)
结果树:
![image-20210715200336526](https://pic.bitday.top/i/2025/05/26/tzp10i-0.png)