Locust 安装
环境:CentOS 7.4,python2.7.5
# 安装 pip
yum -y install python-pip
# 安装 locustio
pip install locustio
mkdir scripts ;cd scripts/
vi locust_test.py
# 内容为
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
    @task
    def baidu_index(self):
        self.client.get("/")
class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait = 3000
    max_wait = 6000
# 启动
locust -f locust_test.py --host=https://www.baidu.com
locust post 登录
vi locust_login.py
from locust import HttpLocust, TaskSet, task
import json
class UserBehavior(TaskSet):
    def on_start(self):
        self.login()
    @task(1)
    def login(self):
        request_url = "/app/user/login"
        request_json = {"reqBody":{"account":"xxxx","loginType":1,"password":"xxxxxxxx","openId":"","shareUid":""}}
        response = self.client.post(request_url, json=request_json)
        if response.status_code != 200:
            print "error"
            print "response status code:", response.status_code
        elif response.status_code == 200:
            print "ok"
class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait = 1000
    max_wait = 1000
locust -f locust_login.py --host=https://www.xxx.com
Locust 安装的更多相关文章
- Python3中性能测试工具Locust安装使用
		Locust安装使用: 安装: python3中 ---> pip3 install locust 验证是否安装成功---> 终端中输入 locust --help ... 
- Locust安装教程与使用
		Locust安装教程与使用官网地址:https://github.com/locustio/locust 如果是python3+以上的环境,需要下载locust项目源码进行安装 因Centos7.2环 ... 
- locust安装及其简单使用----基于python的性能测试工具
		1.已安装python3.6 ,安装步骤略 pip安装: pip install locust 检查locust是否安装成功 locust --help 2.安装 pyzmq If you inten ... 
- python locust 性能测试:locust安装和一些参数介绍
		安装参考 https://www.cnblogs.com/fnng/p/6081798.html <虫师大大的,很详细> ps:python3.7暂不支持locust:python3安装建 ... 
- Python 3.6 性能测试框架Locust安装及使用
		背景 Python3.6 性能测试框架Locust的搭建与使用 基础 python版本:python3.6 开发工具:pycharm Locust的安装与配置 点击“File”→“setting” 点 ... 
- Locust性能测试工具的安装及实际应用
		一.安装Locust 安装Locust之前先安装的库:gevent库:第三方库,gevent为python提供了比较完善的协程支持.使用gevent,可以获得极高的并发性能. pip install ... 
- Locust 性能测试工具安装使用说明
		1. 介绍 它是一个开源性能测试工具.使用 Python 代码来定义用户行为.用它可以模拟百万计的并发用户访问你的系统. 性能工具对比 LoadRunner 是非常有名的商业性能测试工具,功能 ... 
- linux安装locust及遇到的坑
		安装locust很简单,简单的我以为pip install一下就好了,结果运行locust死活不行,后来的后来,,才搞清楚还要进行以下操作. 前提: 1.已安装Python3和pip3(或者都是2,版 ... 
- 性能测试工具Locust
		An open source load testing tool. 一个开源性能测试工具. define user behaviour with python code, and swarm your ... 
随机推荐
- Microsoft Windows Server 2012 Ad域搭建
			Microsoft Windows Server 2012 Ad域搭建 一.Active Directory概念 AD(活动目录):是一种组织资源信息的方法,目录的意义在于我们可以通过标题或者说搜索条 ... 
- Metasploit Framework(3)Meterpreter
			文章的格式也许不是很好看,也没有什么合理的顺序 完全是想到什么写一些什么,但各个方面都涵盖到了 能耐下心看的朋友欢迎一起学习,大牛和杠精们请绕道 Meterpreter:是一种高级的,动态的,可拓展的 ... 
- shell 中let无法使用的原因
			运行 sh let.sh 时,却显示 let: not found 百度之后知道: /bin/sh指向了dash而不是bash,dash不支持let命令. 解决方法: 法1.使用 bash ... 
- ASP.NET Core微服务+Tabler前端框架搭建个人博客2--系统架构
			功能分析 在整个微服务架构的搭建过程中,我们需要做的第一步就是对服务进行拆分,将一个完整的系统模块化,通过对各个模块互联,共同完成一个系统的工作.既然要做到模块化,那么必须明白你的系统的需求到底是什么 ... 
- vue webpack配置解决跨域问题
			现在基本项目都是实行前后端分离的原则,不管是ng 或者是vue 在开发中都无法避免跨域的这个问题 本人刚上手第一个vue项目,在调用api的时候出现了跨域的这个问题 这是封装好一个简单的post 请求 ... 
- Android--多线程之Looper
			前言 上一篇博客讲解了Handler实现线程间通信,这篇博客讲解一下Handler运行的原理,其中涉及到MessageQueue.Looper.简要来讲,Handler会把一个线程消息发送给当前线程的 ... 
- new Date()浏览器兼容性问题
			不同浏览器有不同的差异,一般时间格式是“2018-11-13”,这种格式在Chrome下是可以正常执行的,不过在ie浏览器里面 就会变成NaN 解决方法:将时间转换成“2018/11/13” 这种格式 ... 
- Salesforce Sales Cloud 零基础学习(二) Account 和 Contact
			上一篇我们讲了Sales Cloud 中关于一个公司的产品和定价手册的概念,产品需要卖给企业客户(包括渠道伙伴以及合作伙伴等等)或者是个人客户,那客户信息存在哪里?针对企业客户,通过谁去串联起和企业客 ... 
- leetcode — search-for-a-range
			import java.util.Arrays; /** * Source : https://oj.leetcode.com/problems/search-for-a-range/ * * Cre ... 
- javaScript之分支判断与内置对象
			一,分支结构 单一选择结构(if) 二路选择结构(if/else) 内联三元运算符 ?: 多路选择结构(switch) 1.1 if 控制语句 if-else基本格式: if (表达式){ 语句1; ... 
