locust load test

来源:互联网 发布:cici网络里是什么意思 编辑:程序博客网 时间:2024/04/27 22:45

fromlocust importHttpLocust, TaskSet, task

"""
http://docs.locust.io/en/latest/
locust -f  ./demolocust.py --host=http://docs.locust.io"""class UserBehavior(TaskSet):    def on_start(self):      """ on_start is called when a Locust start before any task is scheduled """      self.index()    def index(self):       self.client.get("/")    @task(2)    def quickstart(self):        self.client.get("/en/latest/quickstart.html")    @task(1)    def api(self):        self.client.get("/en/latest/api.html")class WebsiteUser(HttpLocust):    task_set = UserBehavior    min_wait=5000    max_wait=9000

0 0
原创粉丝点击