其他分享
首页 > 其他分享> > 2 locust 发送 post 请求

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

 

标签:HttpLocust,task,self,locust,发送,TaskSet,post,data
来源: https://www.cnblogs.com/lizitestdev/p/14329373.html