2 locust 发送 post 请求

1 脚本

from locust import HttpLocust, TaskSet, task, between
 
# 新建任务集
class TestLogin(TaskSet):
    @task
    def req_index(self):
        data = {
            "username": "admin",
            "password": "admin123456",
        }
        login_response = self.client.post('/XXX', data=data)
 
 
# 访问设置
class RunTest(HttpLocust):
    task_set = TestLogin
    wait_time = between(1, 2)
    host = "https://www.baidu.com"

2 命令

locust -f login.py

 

上一篇:locust+python的入门


下一篇:locust_02_编写locust file文件