一、Locust基于python,可编辑性与伸缩性非常好
1、特性
python语言编写、分布式和可扩展的-支持成千上万的用户、基于web UI界面的、可支持任何系统
2、安装
$ pip3 install locust
$ pip3 install -e git://github.com/locustio/locust.git@master#egg=locust
3、示例
import time from locust import HttpUser, task, between class QuickstartUser(HttpUser): wait_time = between(1, 2.5) @task def hello_world(self): self.client.get("/hello") self.client.get("/world") @task(3) def view_items(self): for item_id in range(10): self.client.get(f"/item?id={item_id}", name="/item") time.sleep(1) def on_start(self): self.client.post("/login", json={"username":"foo", "password":"bar"})
原文:https://www.cnblogs.com/qtp-1/p/14168134.html