Locust:如何指定获取查询参数的get请求

时间:2018-06-14 10:58:26

标签: python locust

我想加载测试我的get请求

http://localhost:8080/v1/synonyms/project/?keyword=dealer

和测试方法是

@task(2)
def get_synonym(self):
    response = self.client.get("/v1/synonyms/project/")
    print("Response status code:", response.status_code)
    print("Response content:", response.text)

1 个答案:

答案 0 :(得分:2)

传递url中的查询字符串:

response = self.client.get("/v1/synonyms/project/?keyword=dealer")