性能测试(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/
输入并发数和循环次数
'''

猜你喜欢

转载自www.cnblogs.com/lbfang/p/12416976.html