🙄

Locust導入メモ【2023年1月】

に公開

参照
https://docs.locust.io/en/stable/index.html

環境

Mac M1 Monterey
pip 20.3.4

インストール

$ pip3 install locust

導入できたか確認

$ locust -V
locust 2.14.2 from ~~~

導入これだけ。便利

テスト

テストファイル作成

locustfile.py
from locust import HttpUser, task

class HelloWorldUser(HttpUser):
    @task
    def hello_world(self):
        self.client.get("/hello")
        self.client.get("/world")
$ cd /locustfile.pyのあるフォルダ
# 起動
$ locust

起動したら以下にアクセス
http://localhost:8089/

Discussion