locust

from locust import HttpLocust,TaskSet,task

class UserVue(TaskSet):
    #tasks = {buy:1,consume:2} #设置权重
    def login(self):
        self.client.post('/login.do',{"user":"admin","pwd":"123456"})

    def on_start(self):
        self.login()

    def on_stop(self):
        pass

@task(1)
def buy(self):
    self.client('/exeInterface',{"id":100,"job":"15666625"})
@task(2)
def consume(self):
    self.client.post('/cdpipeline-server/consumer',{"id":22.,"jonName":"job_1444"})


class WebsiteUser(HttpLocust):
    task_set = UserVue
    min_wait = 200
    max_wait = 8000    # ms
    stop_timeout = 20  #s
    host=''

  

posted @ 2019-03-31 23:40  不带R的墨菲特  阅读(155)  评论(1)    收藏  举报