小编Bid*_*yut的帖子

在蝗虫如何从一个任务获得响应并将其传递给其他任务

我已经开始使用Locust进行性能测试.我想向两个不同的终点发出两个帖子请求.但是第二个帖子请求需要第一个请求的响应.如何以方便的方式做到这一点.我尝试过如下,但没有工作.

from locust import HttpLocust, TaskSet, task

class GetDeliveryDateTasks(TaskSet):

    request_list = []

    @task
    def get_estimated_delivery_date(self):
        self.client.headers['Content-Type'] = "application/json"
        response = self.client.post("/api/v1/estimated-delivery-date/", json=
        {
            "xx": "yy"

        }
          )
        json_response_dict = response.json()
        request_id = json_response_dict['requestId']
        self.request_list.append(request_id)


    @task
    def store_estimated_delivery_date(self):
        self.client.headers['Content-Type'] = "application/json"
        response = self.client.post("/api/v1/estimated-delivery-date/" + str(self.request_list.pop(0)) + "/assign-order?orderId=1")


class EDDApiUser(HttpLocust):
    task_set = GetDeliveryDateTasks
    min_wait = 1000
    max_wait = 1000
    host = "http://localhost:8080"
Run Code Online (Sandbox Code Playgroud)

python locust

9
推荐指数
1
解决办法
8736
查看次数

如何用robotframework替换文件中的文本/字符串

我在当前的工作目录中复制了一个文件.这个文件有一个文字:

订单价值= 78

我想用新文本替换这个文本

宗地值= 500

我怎样才能做到这一点?

robotframework

2
推荐指数
1
解决办法
5637
查看次数

标签 统计

locust ×1

python ×1

robotframework ×1