1、清晰性能测试的需求,明确行动的目标
2、编写访问首页登录的脚本,并执行通过
from locust import HttpLocust, task, TaskSet, between
# 测试类:用户行为
class UserBehavior(TaskSet):
# 测试任务:访问首页
@task
def test_login(self):
# 发送首页请求给服务器
self.client.get("/home")
class WebSiteUser(HttpLocust):
host = "https://xxxx.com"
task_set = UserBehavior # 指定测试任务
wait_time = between(2, 5)