标签:import from task color elf __name__ targe login --
1 执行顺序
@task(1) 此时不表示权重,表示执行多少次
from locust import TaskSequence, task, HttpLocust, between class TestLogin(TaskSequence): # locust 1.0 以上版本叫 SequentialTaskSet @seq_task(1) # locust 1.0 以上版本不需要这个装饰器 @task(1) def do_something_1(self): pass @seq_task(2) @task(1) def do_something_2(self): pass @seq_task(3) @task(1) def do_something_2(self): pass class RunTest(HttpLocust): # 有变化。HttpLocust 改为 HttpUser/FastHttpUser task_set = {TestLogin} # 有变化。task_set 改为 tasks。且值为 dict wait_time = between(0, 0) host = "" if __name__ == ‘__main__‘: import os os.system(‘locust -f ./locustfile2.py --web-host=127.0.0.1 --web-port=9999‘)
标签:import from task color elf __name__ targe login --
原文地址:https://www.cnblogs.com/lizitestdev/p/14336474.html