Jmeter 生成HTML报表
Jmeter 如何生成HTML报表,这里提供两种方式:[*]Jmeter+ANT
[*]Jmeter(>=3.0) 命令
Jmeter+ANT
解析:
用执行ant 中的build.xml 来调用jmeter进行压测,用xsl语言解析压测结果*.jtl文件套用 模板文件,生成报表html,
优势:
1、可以自定义报表,只关心自己需要的数据
问题:
xsl在解析jtl文件的时候,会一下子将jtl文件加载到内存中进行解析,如果jtl文件过大,那么就会产生内存溢出的情况,这个是死结。
解决方案
用jmeter的命令生产自带的原生报告,折腾来折腾去,想要去美化测试报告,最后发现原生的才是最稳定的,要求 jmeter 3.0 版本以上
Jmeter(>=3.0) 命令
常见的Jmeter命令:
-h 帮助 -> 打印出有用的信息并退出
-n 非 GUI 模式 -> 在非 GUI 模式下运行 JMeter
-t 测试文件 -> 要运行的 JMeter 测试脚本文件
-l 日志文件 -> 记录结果的文件
-r 远程执行 -> 在Jmter.properties文件中指定的所有远程服务器
-H 代理主机 -> 设置 JMeter 使用的代理主机
-P 代理端口 -> 设置 JMeter 使用的代理主机的端口号
Jmeter帮助文档
===============================================================================
C:\Users\Administrator>jmeter -h
Writing log file to: C:\Users\Administrator\jmeter.log
_ ____ _ ____ _ _ _____ _ ____ _____ _____ _____ ____
/ \|_ \ / \/ ___| | | | ____| | |\/| ____|_ _| ____|_ \
/ _ \ | |_) / _ \| | | |_| |_| _| | |\/| |_| | | |_| | |_) |
/ ___ \|__/ ___ \ |___|_| |___| |_| | || | |___| | | |___|_ <
/_/ \_\_| /_/ \_\____|_| |_|_____|\___/|_||_|_____| |_| |_____|_| \_\ 3.1 r1770033
Copyright (c) 1999-2016 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
--------------------------------------------------
To generate a Report from existing CSV file:
Open a command prompt (or Unix shell) and type:
jmeter.bat(Windows)/jmeter.sh(Linux) -g -o
--------------------------------------------------
To tell Apache JMeter to use a proxy server:
Open a command prompt and type:
jmeter.bat(Windows)/jmeter.sh(Linux) -H -P
---------------------------------------------------
To run Apache JMeter in server mode:
Open a command prompt and type:
jmeter-server.bat(Windows)/jmeter-server(Linux)
---------------------------------------------------
Demo:
jmeter -n -t tougu.jmx -l test.jtl -e -o ResultReport
注意:
test.jtl : 没有这个文件cunzau
ResultReport :文件夹,这个文件夹下内容为空
感谢分享 感谢分享
页:
[1]