Locust是一个易于使用、可编写脚本且可扩展的性能测试工具。 使用Python代码定义用户行为,允许数百万并发用户支持系统。
官网: https://locust.io/
文档: https://docs.locust.io/en/stable/
代码: https://github.com/locust io/locust
在代码中定义用户行为
不需要笨拙的UI或巨大的XML。 是普通的代码。
分布式和可扩展
Locust支持分布在多台计算机上的运行负载测试,因此可用于模拟数百万并发用户
经过验证和战斗力测试
Locust已经被用于模拟数百万并发用户。 Battlelog是《战地风云》游戏的网络APP应用,由于使用Locust进行了负载测试,因此可以说Locust通过了Battletested; )
安装PyPI并使用pip命令。
pip install Locust示例代码locust的基本功能是用Python代码编写所有测试。 不需要笨拙的UI或巨大的XML。 只要简单的代码就可以了。 locustfile.py
from locust import HttpUser,between,taskclasswebsiteuser(httpuser ) : wait_time=between(5) 5,15 ) def on _ stastar { 'username': 'test_user ),' password ' : ' } @ taskdef index (self ) :self.client.get ) (/) self