본문 바로가기
Open Sources/ETC

Locust Sample Code

by 화뉘 2018. 11. 27.


locustfile.py

from locust import HttpLocust, TaskSet


def login(l):

    l.client.post("/goodnight/api/v3/users/signin/normal", {"email":"joe.cho@email.com", "pw":"password", "social_id":0})


def profile(l):

    l.client.get("/goodnight/api/v3/users/profile")


class UserBehavior(TaskSet):

    tasks = {profile: 1}


    def on_start(self):

        login(self)


class WebsiteUser(HttpLocust):

    task_set = UserBehavior

    min_wait = 5000

    max_wait = 9000 


locust -f locustfile.py --host=https://SEVER_IP 


http://127.0.0.1:8089/


'Open Sources > ETC' 카테고리의 다른 글

PhantomJS(팬텀JS)  (0) 2018.11.26
locust 관련 정보  (0) 2017.08.25
Kali Linux (칼리 리눅스)  (0) 2016.10.11
Vagrant  (0) 2016.07.20
Slack  (0) 2016.07.11

댓글