首页 > 编程语言 > 详细

性能测试(Python + Locust )--初见

时间:2020-03-05 00:54:56      阅读:82      评论:0      收藏:0      [点我收藏+]
from locust import HttpLocust, TaskSet, task


class TestIndex(TaskSet):
@task
def getIndex(self):
self.client.get("https://tianqiapi.com/api?appid=21714715&appsecret=IIyz3c8o")
print("hello")


class WebSite(HttpLocust):
task_set = TestIndex
min_wait = 1000
max_wait = 2000



‘‘‘

编写脚本
打开CMD进入源码文件目录
执行 locust -f test.py --host=https://tianqiapi.com/api?appid=21714715&appsecret=IIyz3c8o
打开浏览器访问 http://localhost:8089/
输入并发数和循环次数
‘‘‘

性能测试(Python + Locust )--初见

原文:https://www.cnblogs.com/lbfang/p/12416976.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!