当前位置:   article > 正文

Python+Locust性能测试_locust 性能测试报告

locust 性能测试报告

Python+Locust性能测试

1、设置断言监控接口请求成功和失败,一定要再请求接口的时候添加catch_response=True这个参数,locust会通过自定义情况来判断接口请求的成功与否
(比如说接口返回404,500的时候,如果不添加此块代码,locust也会自动统计为接口请求是成功的)

   response=self.client.post(接口地址,json=参数,catch_response=True)
   if "login_pass" in response.txt:
       response .success()
  else:
       response .failure("Can not login!")

   可以在主函数中通过os.system("locust -f ability_locust.py --host=http://www.baidu.com") 来本地启动和调试locust
   locust参考文档:https://cloud.tencent.com/developer/article/1594240
   locust官方文档:https://docs.locust.io/en/stable/quickstart.html
   locust代码demo参考文档:http://

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/515100
推荐阅读
相关标签
  

闽ICP备14008679号