ubuntu16.04环境
2.解压JMeter以及配置
sudo unzip apache-jmeter-4.0.zip
sudo mv apache-jmeter-4.0 /opt/
sudo ln -s /opt/apache-jmeter-4.0/ /opt/jmeter
3.启动JMeter
/opt/jmeter/bin/jmeter.sh
4.创建图标
sudo vim ~/.local/share/applications/apache_jmeter.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=JMeter
Icon=apache_jmeter.png
Path=/opt/apache-jmeter-4.0
Exec=java -jar /opt/jmeter/bin/ApacheJMeter.jar
StartupNotify=false
StartupWMClass=Apache JMeter
OnlyShowIn=Unity;
X-UnityGenerated=true
5.完成
1.png
6.启动JMeter
7.使用方法与windows同,见下方
windows环境
2.解压后,启动点击如下图标
apache-jmeter-4.0\bin\jmeter.bat
3.使用方法
(1)范例以tornado框架写了一个测试服务
###test.py
# -*- coding: utf-8 -*-
import tornado.ioloop
import tornado.web
class TestHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
self.write("Hello World, test test test")
application = tornado.web.Application([
(r'/test',TestHandler),
])
if __name__ == "__main__":
application.listen(8080)
tornado.ioloop.IOLoop.instance().start()
(2)启动web服务
python test.py
(3)配置JMeter
1.png
2.png
3.png
4.png
5.png
(4)将配置保存到你自己的目录
(5)启动测试
6.png
(6)测试完成后进入JMeter的安装目录的bin,启动命令行
jmeter -n -t C:\Users\WJXZ\Desktop\jmeter\tornado.jmx -l C:\Users\WJXZ\Desktop\jmeter\html.csv -e -o C:\Users\WJXZ\Desktop\jmeter\HttpReports
7.png
8.png
(6) 生成的目录结构
9.png
(7)结果
10.png
网友评论