jmeter生成HTML报告笔记

小编今天学习下传说中的压测神器jmeter,尝尝测试的味道。

为了使用方便,配置环境变量先

D:\apps\apache-jmeter-5.1.1\bin

启动jmeter配置jmx脚本

jmeter

启动日志

Microsoft Windows [版本 10.0.18362.836]
(c) 2019 Microsoft Corporation。保留所有权利。

E:\jmeter>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
================================================================================

启动后在软件界面随便配置几个接口,保存生成 jmx 文件。

执行并输出报告

jmeter -n -t ./jmx/test.jmx -l .\file -e -o .\report

该命令对应的目录结构及说明

jmeter
    ├─jmx/        --放置jmx脚本的目录
    └─report/    -- 生成报告保存目录
    └─file        -- 看起来像是接口请求日志文件

参考日志

E:\jmeter>jmeter -n -t ./jmx/test.jmx -l .\file -e -o .\report
Creating summariser <summary>
Created the tree successfully using ./jmx/test.jmx
Starting the test @ Fri Jun 05 10:53:23 CST 2020 (1591325603083)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary +     10 in 00:00:07 =    1.5/s Avg:   656 Min:   584 Max:   811 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary +     48 in 00:00:30 =    1.6/s Avg:   618 Min:   580 Max:   712 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary =     58 in 00:00:37 =    1.6/s Avg:   625 Min:   580 Max:   811 Err:     0 (0.00%)
summary +     42 in 00:00:26 =    1.6/s Avg:   618 Min:   576 Max:   695 Err:     0 (0.00%) Active: 0 Started: 1 Finished: 1
summary =    100 in 00:01:03 =    1.6/s Avg:   622 Min:   576 Max:   811 Err:     0 (0.00%)
Tidying up ...    @ Fri Jun 05 10:54:26 CST 2020 (1591325666155)
... end of run
E:\jmeter>

参数详细讲解参考Jmeter导出测试报告

版权声明

弈心博客


本文首发site_name,转载请附上博文链接!