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

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/
输入并发数和循环次数
'''
posted @ 2020-03-04 23:23  房龙波  阅读(422)  评论(0)    收藏  举报