【Python】【性能】Locust

locust版本:1.2.3

https://www.cnblogs.com/shog808/p/13563515.html

https://www.jianshu.com/p/9c4ffee61eea

https://testerhome.com/topics/7607

 

一、快速上手

step1:代码

"""
-*- coding:utf-8 -*-
@Time   :2020/8/28 15:43
@Author :Jarvis
@File   :jar_locust_util.py
@Version:1.0
"""
from locust import task, between
from locust.contrib.fasthttp import FastHttpUser


class TestTasks(FastHttpUser):
    # 每任务间隔时间
    wait_time = between(1, 3)
    # 测试接口环境
    host = 'http://www.test.com'

    @task
    def task_a(self):
        print('测试任务(请求接口)')


if __name__ == '__main__':
    import os

    os.system('locust -f jar_locust_util.py')  # locust -f py文件

 

 step2:http://localhost:8089/

 step3:看效果

 

 

posted @ 2020-08-28 14:29  淡怀  阅读(282)  评论(0编辑  收藏  举报