当前位置:网站首页>jmeter接口测试(登录、注册)
jmeter接口测试(登录、注册)
2022-07-27 02:25:00 【测试小鬼】
Jmeter 进行接口测试流程:
Jmeter 的下载地址:http://jmeter.apache.org/download_jmeter.cgi
下面举例说明使用流程,有两种参数传递的方式,我们以登陆、注册分别举例
1、先添加线程组,参数设置如图
线程数:可以理解成登陆账号的数量
循环次数:就是循环执行你设置的线程数
如图表示:10秒内执行10个线程,循环2次,总共执行了20次
循环次数如果选择永远,程序会一直执行,除非手动停止

2、添加http请求:参数设置如下
协议:看服务部署的是http还是https,这里选择http
一般开发需要你去测试接口会给一个地址:http://www.patballoon.com/auth/register或者http://121.43.191.73:3100/auth/register
服务器名称:www.patballoon.com
端口号:3100 如果选择域名的话端口号可以为空
路径:/auth/register
方法:post
同请求一起传递的参数:这里测试的是注册,所以传递的参数有:账号,密码,地址

下图可以添加参数,参数个数要看接口代码,这里需要传递如图:username\password\address
3 、添加聚合报告、查看结果树、用表格查看结果,都是为了分析测试的结果。简单分析一下报告,sample:20个就是我们一开始在线程组设置的参数

4、查看结果树
左图绿色代表通过,右边是一些测试的结果,可是查看每一次的http的请求情况以及相应数据

上面是注册的接口,下面演示登陆的接口测试,登陆我们可能用到的数据比较多,所以我们需要把数据写在一个文档里,用 jmeter来调用,其他俩程都是一样的,不一样的是要用到csv 存数据:
1、我们先把测试的数据存到文档里,如下图1,登陆需要的接口参数看代码,图1中参数为Username、Password、Auth,这里模拟4个用户

2、 添加csv ,如图2参数设置:
filename:这个是上图1我们设置的用户,保存的文档路径
Lgnore first line :这个是图1文档是否去掉第一行,选择是
Variable name:变量名字是自己定义的

3、http请求设置如图3:
添加参数:名称为接口代码定义的参数,值要和图中的形式一样,参数和图2定义的保持 一致

4、聚合报告和注册时一样查看
聚合报告:如果添加在线程组下面是单个线程的报告结果如上图
下面是添加在线程组外面的聚合报告,现实两个线程组饿报告结果

边栏推荐
- About the solution of using hyperbeach to appear /bin/sh: 1: packr2: not found
- Kettle reads file split by line
- Redis spike case, learn from Shang Silicon Valley teacher in station B
- Food chain (day 79)
- Banyan data model of Bairong
- 【无标题】
- Csu18m91 is used as the master controller of the intelligent scale scheme
- Six determination methods of Worthington peroxidase activity
- 飞腾腾锐 D2000 荣获数字中国“十大硬核科技”奖
- C语言力扣第43题之字符串相乘。优化竖式
猜你喜欢

Programming implementation of eight queens

一种分布式深度学习编程新范式:Global Tensor

MySQL has a nonexistent error

基于OpenCV的轮廓检测(2)

Principle understanding and application of hash table and consistent hash

面试题:String类中三种实例化对象的区别

Meta Quest内容生态总监谈App Lab设计初衷

代码回滚,你真的理解吗?

小于等于K的最大子数组累加和

The function and application of lpci-252 universal PCI interface can card
随机推荐
03.获取网页源代码
次轮Okaleido Tiger即将登录Binance NFT,引发社区热议
Digital analog 1232
C# 使用SqlSugar Updateable系统报错无效数字,如何解决?求指导!
Characteristics and determination scheme of Worthington pectinase
Tool class of localdatetime sorted out by yourself
Specific use of multithreading
Ring counting (Northern Polytechnic machine test questions) (day 83)
MySQL Chinese failure
connman介绍
unity之二维数组实现正六边形地图
一种分布式深度学习编程新范式:Global Tensor
Director of meta quest content ecology talks about the original intention of APP lab design
"Date: write error: no space left on device" solution
Record the problem of PHP program accessing system files incorrectly
04. Detailed steps for installing the simulated browser chromedriver in Google browser
C语言力扣第43题之字符串相乘。优化竖式
flinkSQLclient创建的job,flink重启就没了,有什么办法吗?
Method of converting curtain article OPML into markdown
Two help points distribution brings to merchants