掌握JMeter使用方法,至少使用三种监听器,将实验分析报告复制到实验报告内。
时间: 2024-02-28 21:53:34 浏览: 14
JMeter是一款用于性能测试的工具,可以模拟多种负载情况并分析系统的性能表现。在使用JMeter时,可以使用多种监听器来获取测试结果并生成报告。以下是三种常用的监听器及其使用方法:
1. Summary Report
Summary Report是一种简单的报告,它可以显示每个请求的响应时间、吞吐量、错误率等信息。使用方法如下:
- 在测试计划中添加一个线程组。
- 在线程组下添加一个HTTP请求。
- 在HTTP请求上右键点击,选择Add -> Listener -> Summary Report。
- 运行测试并查看Summary Report的结果。
Summary Report的输出结果类似于下面这样:
```
Label # Samples Average Median 90% Line Min Max Error % Throughput Received KB/sec Sent KB/sec
HTTP Request 1000 2343 2234 3456 1234 5678 0.0% 100.0/sec 23.4 12.3
```
2. View Results Tree
View Results Tree是一种详细的报告,它可以显示每个请求的请求头、响应头、响应正文等信息。使用方法如下:
- 在测试计划中添加一个线程组。
- 在线程组下添加一个HTTP请求。
- 在HTTP请求上右键点击,选择Add -> Listener -> View Results Tree。
- 运行测试并查看View Results Tree的结果。
View Results Tree的输出结果类似于下面这样:
```
Thread Name: Thread Group 1-1
Sample Start: 2022-05-01 00:00:01 CST
Load time: 1234
Connect Time: 456
Latency: 123
Size in bytes: 5678
Headers size in bytes: 123
Body size in bytes: 5555
Sample Count: 1
Error Count: 0
Data type ("text"|"bin"|""): text
Response code: 200
Response message: OK
Response headers:
HTTP/1.1 200 OK
Date: Sun, 01 May 2022 00:00:01 GMT
Server: Apache/2.4.49 (Unix)
Content-Length: 5555
Content-Type: text/html;charset=UTF-8
```
3. Aggregate Report
Aggregate Report是一种汇总的报告,它可以显示每个请求的响应时间、吞吐量、错误率等信息,并将所有请求的信息汇总在一起。使用方法如下:
- 在测试计划中添加一个线程组。
- 在线程组下添加多个HTTP请求。
- 在测试计划上右键点击,选择Add -> Listener -> Aggregate Report。
- 运行测试并查看Aggregate Report的结果。
Aggregate Report的输出结果类似于下面这样:
```
Label # Samples Average Median 90% Line Min Max Error % Throughput Received KB/sec Sent KB/sec
HTTP Request 1 1000 2343 2234 3456 1234 5678 0.0% 100.0/sec 23.4 12.3
HTTP Request 2 1000 1234 1345 2345 5678 12345 0.0% 100.0/sec 12.3 23.4
Total 2000 1789 1567 2890 1234 12345 0.0% 200.0/sec 35.7 35.7
```
将实验分析报告复制到实验报告内的方法:
- 运行测试并生成相应的监听器报告。
- 在监听器报告上右键点击,选择Save Table Data。
- 将输出结果复制到实验报告中即可。