14

JMeter-While控制器

 4 years ago
source link: http://www.cnblogs.com/zhangwuxuan/p/12389794.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

前言

While 控制器,直到条件为false时,停止运行 ,循环执行一个请求,仅判断一种状态下退出循环。 

Condition条件如下: 

1:为空(不输入任何值) -- 直到某次请求执行失败才退出循环 

2:LAST -- 直到最后一个请求请求失败才退出循环 

3:其它 -- 条件值等于"false"时,退出循环 

4:Contion可以输入计算结果等于“false”的变量、函数。

示例:

(1)添加线程组,添加逻辑控制器-While控制器,while控制器下添加计数器以及登录http请求

通过计数器让登录请求有10次循环,每次递增加1,引用变量名称为user

NrUZR3n.png!web

userName的值引用计数器的变量user

vMJ3a2E.png!web

While控制器写入${__javaScript(${user}<"3")}, 表示在{num}只能执行循环3次

JzUVnqq.png!web

yM7ZrmU.png!web

${__javaScript("${user}"!=3 && "${user}"<"2",)},表示同时满足${user}"!=3 ,和 "${user}"<"2"才进入循环体,即$ {user}不等于3的情况下只能执行2次循环

MNBnEzu.png!web

ZFfY7zJ.png!web


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK