from locust import HttpLocust, TaskSet, task # 定义用户行为 class UserBehavior(TaskSet): def on_start(self): print("start") @task(1) def bky_index(self): self.client.get("/") @task(2) def blogs(self): self.client.get("/Clairewang/p/8622280.html") class WebsiteUser(HttpLocust): host = "https://www.baidu.com" task_set = UserBehavior min_wait = 1500 max_wait = 5000