我正在使用蝗虫对我们的应用程序进行压力测试。
我收到错误消息,因为POST调用似乎不正确。在哪里可以看到刺槐的日志?我想看看邮寄电话的样子,看看有什么问题。
这是我的代码,以防有人可以告诉我我做错了什么:
from locust import HttpLocust, TaskSet, task
json3 = """{"stack_name": "beenz-php-app-12", "disable_rollback": true, "template": "php", "timeout_mins": 60}"""
class MyTaskSet(TaskSet):
@task
def send(self):
response = self.client.post("/stacks", json3, headers={'X-Auth-Key': 'xxxx', 'Content-Type': 'application/json', 'X-Auth-User': 'xxxx', 'Accept': 'application/json', 'X-Auth-Token':'xxxx'})
print "Response status code:", response.status_code
print "Response content:", response.content
class MyLocust(HttpLocust):
task_set = MyTaskSet
min_wait = 5000
max_wait = 15000
谢谢!
最佳答案
通过在启动蝗虫时添加--logfile=locustfile.log
参数,您的print
消息将被重定向到名为locustfile.log
的文件,我认为这是您在问题中提到的日志。
假设您的蝗虫文件名为locustfile.py
。然后您在本地计算机上运行蝗虫。您可以通过locust --host=http://127.0.0.1 --logfile=locustfile.log
来开始蝗虫。然后,您将可以对http://127.0.0.1:8089/
进行蝗虫测试。
关于logging - 在哪里可以找到刺槐原木?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26049264/