导言:2021年7月6日,locust更新迈入2.0.0版本。Locust是一款易于使用的分布式负载测试工具,完全基于事件,即一个locust节点也可以在一个进程中支持数千并发用户,不使用回调,通过gevent使用轻量级过程。因为与httprunner作为接口框架搭配起来使用,能快速便捷的进行高质量的性能测试,而倍受测试人员的喜爱。
安装:
pip install locust==2.1.0
检查安装结果:
pip show locust
目录结构:
│ argument_parser.py
│ clients.py
│ dispatch.py
│ env.py
│ event.py
│ exception.py
│ html.py
│ input_events.py
│ log.py
│ main.py
│ runners.py
│ shape.py
│ stats.py
│ web.py
│ __init__.py
│ __main__.py
│
├─contrib
│ │ fasthttp.py
│ │ __init__.py
│ │
│ └─__pycache__
│ fasthttp.cpython-39.pyc
│ __init__.cpython-39.pyc
│
├─rpc
│ │ protocol.py
│ │ zmqrpc.py
│ │ __init__.py
│ │
│ └─__pycache__
│ protocol.cpython-39.pyc
│ zmqrpc.cpython-39.pyc
│ __init__.cpython-39.pyc
│
├─static
│ │ chart.js
│ │ echarts.common.min.js
│ │ jquery-1.11.3.min.js
│ │ jquery.jqote2.min.js
│ │ jquery.tools.min.js
│ │ locust.js
│ │ vintage.js
│ │
│ ├─css
│ │ application.css
│ │ application.css.map
│ │ tables.css
│ │ tables.css.map
│ │
│ ├─img
│ │ favicon.ico
│ │ logo.png
│ │ ui-screenshot-charts.png
│ │ ui-screenshot-start-test.png
│ │ ui-screenshot-stats.png
│ │ ui-screenshot-workers.png
│ │
│ └─sass
│ application.sass
│ tables.sass
│ _base.sass
│ _mixins.sass
│
├─templates
│ index.html
│ report.html
│ stats_data.html
│
├─test
│ │ fake_module1_for_env_test.py
│ │ fake_module2_for_env_test.py
│ │ mock_locustfile.py
│ │ mock_logging.py
│ │ testcases.py
│ │ test_dispatch.py
│ │ test_env.py
│ │ test_fasthttp.py
│ │ test_http.py
│ │ test_locust_class.py
│ │ test_log.py
│ │ test_main.py
│ │ test_old_wait_api.py
│ │ test_parser.py
│ │ test_runners.py
│ │ test_sequential_taskset.py
│ │ test_stats.py
│ │ test_tags.py
│ │ test_taskratio.py
│ │ test_users.py
│ │ test_util.py
│ │ test_wait_time.py
│ │ test_web.py
│ │ test_zmqrpc.py
│ │ util.py
│ │ __init__.py
│ │
│ └─__pycache__
│ fake_module1_for_env_test.cpython-39.pyc
│ fake_module2_for_env_test.cpython-39.pyc
│ mock_locustfile.cpython-39.pyc
│ mock_logging.cpython-39.pyc
│ testcases.cpython-39.pyc
│ test_dispatch.cpython-39.pyc
│ test_env.cpython-39.pyc
│ test_fasthttp.cpython-39.pyc
│ test_http.cpython-39.pyc
│ test_locust_class.cpython-39.pyc
│ test_log.cpython-39.pyc
│ test_main.cpython-39.pyc
│ test_old_wait_api.cpython-39.pyc
│ test_parser.cpython-39.pyc
│ test_runners.cpython-39.pyc
│ test_sequential_taskset.cpython-39.pyc
│ test_stats.cpython-39.pyc
│ test_tags.cpython-39.pyc
│ test_taskratio.cpython-39.pyc
│ test_users.cpython-39.pyc
│ test_util.cpython-39.pyc
│ test_wait_time.cpython-39.pyc
│ test_web.cpython-39.pyc
│ test_zmqrpc.cpython-39.pyc
│ util.cpython-39.pyc
│ __init__.cpython-39.pyc
│
├─user
│ │ inspectuser.py
│ │ sequential_taskset.py
│ │ task.py
│ │ users.py
│ │ wait_time.py
│ │ __init__.py
│ │
│ └─__pycache__
│ inspectuser.cpython-39.pyc
│ sequential_taskset.cpython-39.pyc
│ task.cpython-39.pyc
│ users.cpython-39.pyc
│ wait_time.cpython-39.pyc
│ __init__.cpython-39.pyc
│
├─util
│ │ cache.py
│ │ deprecation.py
│ │ exception_handler.py
│ │ rounding.py
│ │ timespan.py
│ │ __init__.py
│ │
│ └─__pycache__
│ cache.cpython-39.pyc
│ deprecation.cpython-39.pyc
│ exception_handler.cpython-39.pyc
│ rounding.cpython-39.pyc
│ timespan.cpython-39.pyc
│ __init__.cpython-39.pyc
│
└─__pycache__
argument_parser.cpython-39.pyc
clients.cpython-39.pyc
dispatch.cpython-39.pyc
env.cpython-39.pyc
event.cpython-39.pyc
exception.cpython-39.pyc
html.cpython-39.pyc
input_events.cpython-39.pyc
log.cpython-39.pyc
main.cpython-39.pyc
runners.cpython-39.pyc
shape.cpython-39.pyc
stats.cpython-39.pyc
web.cpython-39.pyc
__init__.cpython-39.pyc
__main__.cpython-39.pyc