【发布时间】:2013-06-26 10:05:26
【问题描述】:
我使用 Locust (http://locust.io) 编写了一个简单的负载测试。
现在我注意到,有时(使用更高的负载)我从 post call 得到的响应的 status_code 为 0 和 None 内容。 0状态码在Locust中不会自动识别为失败,所以我必须手动测试一下。
我的代码片段是这样的:
with self.client.get(path, catch_response=True) as response:
if response.status_code != 200:
response.failure(path + ": returned " + str(response.status_code))
elif check not in response.content:
response.failure(path + ": wrong response, missing '" + check + "'")
注意:check 是部分预期响应内容的变量。
问题是:这是预期的行为吗?这是 Locust(或 Python)的问题,还是测试应用程序的问题?
【问题讨论】: