JMeter学习小结【一】

本文为博主原创,未经许可严禁转载。
本文链接:https://blog.csdn.net/zyooooxie/article/details/109985703

新开一个专栏:性能测试,是想分享 和压测相关的;
在我看大佬们的教程 学习时,发现有些地方和官方文档有出入,我就在此做个总结。

个人博客:https://blog.csdn.net/zyooooxie

Fiddler来抓取JMeter的请求

之所以会说Fiddler抓JMeter的请求,是因为有天在用JMeter时,发现报错如下图:

在这里插入图片描述

就有点疑惑,这哪来的127.0.0.1?然后才想到 我设置过代理。

实际工作,我常用的requests、postman、谷歌浏览器发请求,都可以直接被Fiddler抓到;可JMeter的请求,没看到,该咋整呢?

  1. 设定Fiddler监听的端口号

在这里插入图片描述

  1. 对JMeter某请求设置

在这里插入图片描述

  1. HTTP Request Defaults设置

在这里插入图片描述

设置很简单,但用完 务必要关掉

CSV Data Set Config的Sharing mode

官方资料:

官方文档的介绍:

  1. All threads - (the default) the file is shared between all the threads.
  2. Current thread group - each file is opened once for each thread group in which the element appears
  3. Current thread - each file is opened separately for each thread

我的理解:三种 即3个层次:所有线程组、每个线程组、每个线程;

csv文件

在这里插入图片描述

All threads

By default, the file is only opened once, and each thread will use a different line from the file. However the order in which lines are passed to threads depends on the order in which they execute, which may vary between iterations.

在这里插入图片描述

All threads : 不论线程组的线程数、循环数,不区分线程组,不区分线程;按照执行顺序,每次请求,都取新一行数据 【所有线程、所有线程组 一起玩】

Current thread group

each file is opened once for each thread group

在这里插入图片描述

Current thread group: 区分线程组、不同线程组互不关联。线程组内,都是从第一行开始取;每次请求,都取新一行数据;【每个线程组 自己玩】

Current thread

each file is opened separately for each thread

在这里插入图片描述

Current thread:以线程做区分;不同线程,都是从第一行开始取;每次请求 都是新一行数据 【每个线程 自己玩】

"Current thread"的特殊用法

If you want each thread to have its own set of values, then you will need to create a set of files, one for each thread. For example test1.csv, test2.csv, …, testn.csv. Use the filename test${__threadNum}.csv and set the “Sharing mode” to “Current thread”.

  1. C:\apache-jmeter-5.1.1\bin 相对路径

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  1. D:\JMeter\JMeterFolder 绝对路径

在这里插入图片描述

在这里插入图片描述

Switch Controller的Switch Value

官方资料:

我将Switch Value分为3种:数字为索引;str为请求名称;其他情况;

  1. 如果填入数字,是索引 【索引从0开始】

在这里插入图片描述

在这里插入图片描述

  1. 查找具有相同名称的请求(区分大小写)

在这里插入图片描述

在这里插入图片描述

  1. 填入的数字大于索引时,If the switch value is out of range, it will run the zeroth element

在这里插入图片描述

在这里插入图片描述

  1. 填的名称不对

名称都不匹配,则选择名为“ default ”的元素(大小写无关) 【default 大小写都有时,选最后位置】

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  1. 啥都不填【empty】

如果值是空,它将运行第0个元素。 It also runs the zeroth element if the value is the empty string.

在这里插入图片描述

本文是第一篇,后续 第二篇

交流技术 欢迎+QQ 153132336 zy
个人博客 https://blog.csdn.net/zyooooxie

猜你喜欢

转载自blog.csdn.net/zyooooxie/article/details/109985703