性能测试(基于Locust框架)
部署locust
yum install python36.x86_64 -y
pip3.6 install locust
locust -V
performance1
[root@localhost auto_test_plat]# cat performance.py
from locust import HttpLocust,TaskSet,task
class WebsiteTasks(TaskSet):
@task
def index(self):
self.client.get("/")
class WebsiteUser(HttpLocust):
task_set=WebsiteTasks
min_wait=100
max_wait=1000
测试方法
命令行下 输入下面命令
locust -f performance.py --host=http://www.cnblogs.com/
在谷歌浏览器下 打开下面地址 注意换成你自己的ip
http://192.168.85.128:8089/
performance2
[root@localhost auto_test_plat]# cat performance2.py
from locust import HttpLocust,TaskSet,task
class WebsiteTasks(TaskSet):
@task
def index(self):
self.client.post("/test",{
"username":"admin",
"password":"admin"
})
class WebsiteUser(HttpLocust):
task_set=WebsiteTasks
min_wait=100
max_wait=1000
posted on 2019-02-23 17:53 Indian_Mysore 阅读(941) 评论(3) 编辑 收藏 举报