标签:pre span 压力测试 wait login schedule locust test 框架
直接编写接口事务脚本对后台接口进行测试;有时测试需要让所有并发用户完成初始化后再进行压力测试,这就需要类似于LoadRunner中的集合点的概念,由于框架本身没有直接封装,有如下办法实现:
from gevent._semaphore import Semaphore all_locusts_spawned = Semaphore() all_locusts_spawned.acquire() def on_hatch_complete(**kwargs): all_locusts_spawned.release() events.hatch_complete += on_hatch_complete class TestTask(TaskSet): def on_start(self): """ on_start is called when a Locust start before any task is scheduled """ self.login() all_locusts_spawned.wait()
标签:pre span 压力测试 wait login schedule locust test 框架
原文地址:https://www.cnblogs.com/grandlulu/p/9455794.html