当前位置:网站首页>Locust performance test 1 (understanding)
Locust performance test 1 (understanding)
2022-07-17 23:30:00 【Song_ Lun】
One 、 brief introduction
Locust ( grasshopper ) It's an easy to use 、 Scriptable and extensible performance testing tool

Two 、 install loust
# If you have not Python 3.6 Or later , Please install it .
pip3 install locust
# Verify your installation
@songpeilunMacBook-Pro ~ % locust -V
locust 1.4.3
@songpeilunMacBook-Pro ~ %
3、 ... and 、 First time to know
Locust Part of the
Locust from 2 Part of it is made up of
1. The task class ( Inherit TaskSet)
2.Locust class ( Inherit HTTPLocust) notes : stay 1.0 In the version ,HttpLocust Class has been renamed to HttpUser
Locust Operation level
The task class ( Inherit TaskSet)

Illustrate with examples 
test.py file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/11/22 11:06 In the morning
# @Name : peilun
# @File : test.py
# @Software: PyCharm
from locust import HttpUser, TaskSet, task, between
import os
# The task class
# Need to inherit Locust class
class MyTasks(TaskSet):
def setup(self):
print(" Task initialization ")
def teardown(self):
print(" End of the task ")
def on_start(self):
print(" User initialization -- Sign in ")
def on_stop(self):
print(" user -- end ")
@task
def post_login(self):
print(' Custom function execution ...')
# Locust class
class User(HttpUser):
tasks = [MyTasks]
host = 'https://www.baidu.com/'
wait_time = between(2, 2)
def setup(self):
print("Locust initialization ")
def teardown(self):
print("Locust end ")
if __name__ == '__main__':
os.system("locust -f test.py")

边栏推荐
- 軟件測試 接口測試 實戰 微信公眾號平臺 Postman+newman+jenkins 實現自動生成報告並持續集成
- 【C语言入门】----指针(初阶)
- 拼多多店铺所有商品API接口(整店商品列表查询接口)
- Super sub query implements join query gracefully
- 微信公众号开发-自定义菜单
- Differences go array, slice, map
- Serein 【懒人神器】一款图形化、批量采集url、批量对采集的url进行各种nday检测的工具 摸鱼项目问题解决
- How to realize the association between interfaces in JMeter?
- 企业命名规范
- pytest+request+allure+excel接口自动化搭建 从0到1【二 读取Excel Case信息】
猜你喜欢

Target detection -- detailed explanation of Siou principle and code implementation of border regression loss function

.NET 全场景开发终于到来了

Application scheme for remote monitoring of Wutong Bolian photovoltaic power station
![[C language] analog address book (array version, dynamic version, linked list version)](/img/0e/ff1db5e633e8a626a1a058c5241798.png)
[C language] analog address book (array version, dynamic version, linked list version)

MGRE环境下的OSPF实验

Synchnorized原理详解

15.1.1 MySQL - date time function of MySQL, date format

15.1.2、MySQL—mysql时间与时间戳转换的函数,unix_timestamp、from_unixtime

Detailed explanation of synchnorized principle

hyper子查询优雅实现join查询
随机推荐
微信小程序之网易云音乐的实现-云音乐
VMware Photon OS 4 Install
Taobao official goods, transactions, orders, logistics interface list (Taobao oauth2.0 interface)
几行汇编几行C实现一个最简单的内核
YOLO系列论文精度 & YOLOv2 and YOLO9000
企业命名规范
15.1.2、MySQL—mysql时间与时间戳转换的函数,unix_timestamp、from_unixtime
Contact Chen Xianbao. How much can he deal with when the 60 year old man returns?
Detailed explanation of synchnorized principle
.NET Core 使用 ImageSharp 生成图片
On volatile
淘宝app商品详情API接口(商品详情描述信息查询接口)
Week 4 – Linear Text Classification
扎心了!39岁买房后就被裁员了
Serein 【懒人神器】一款图形化、批量采集url、批量对采集的url进行各种nday检测的工具 摸鱼项目问题解决
Keyword search Suning commodity API interface (Suning commodity list API interface)
秒杀项目学习
[useful SQL] check Greenplum's data dictionary
Matlab微分方程的求解
Technology companies have objected, and the UK cybersecurity act has been shelved