If the controller logic controllers Jmeter

Recently busy work, the use of free time to sort out the relevant knowledge under Jmeter, here to share with Jmeter if (if) the use and application control.

FIG follows: Thread Group> Add> Logic Controller> if (IF) controller

 

 

 

 

Expression (must evaluate to true or false ): expression (value must be true or false), that is, the condition of the right of the text box to enter the value must be true or false, (default)

Interpret Condition as Variable Expression ?: default hook option, condition variables interpreted as an expression (expression requires the use of __jexl3 or __groovy)

Evaluate for all children ?: conditions are applied to each sub-item (See in particular column sub appreciated described later)

Note:

1, a yellow exclamation mark on the text box that prompts you recommended __jexl3 or __groovy expression, in order to improve performance, which is the default mode.

2, if the controller can effect thereon subkey

First, the default usage, using an expression __jexl3 or __groovy

Below, there is an access Baidu home page sampler under control if, when and only if conditions are met, will be the implementation of the sampler. Default mode, the condition 1 == 1, into __jexl3 expression.

 

 If you do not know how to use the expression, you can use the function Jmeter assistant, as follows:

 

 Second, direct input conditions

Below, to remove " the Interpret the Expression for condition Condition Variable AS? " In the checkbox, input condition 1 == 1. Home access Baidu sampling will be performed.

 

 

 Third, the use of variable conditions

In many cases, the user variable, or on a sampler return value is determined according to the condition, if this is required that one of the sampler.

Below, add a user variable: ischildren. Conditions: When ischildren value of y Perform access Baidu home page sampler.

 

 

 Or it may be an expression: $ {__ jexl3 ( "$ {ischildren}" == "y",)}.

Four, Evaluate for all children? Usage

In the above understanding of how to use condition variables, if the sampler under execution if a controller changes the value of the variable, followed by lower if the controller sampler will be executed it? Liezi look at the following:

 

 

 There are three sampler controller if the initial value of y, if the conditions for control variables ischildren: $ {__ jexl3 ( "$ {ischildren}" == "y",)}.

Begin to meet the conditions, you should execute access Baidu home page, news page to access Baidu, access to Baidu Post Bar 3 sampler,

However, after performing access Baidu news page, the value of the variable ischildren n, can not meet the "$ {ischildren}" == "y" condition.

So this visit Baidu Post Bar sampler will not be executed.

 

If this time, remove Evaluate for all children? The check, what will happen, you can try their own hands.

supplement:

Conditions:

==  equal as 1 == 1 or $ {__ jexl3 (1 == 1 ,)}

>, <  Greater than less than, for example, 2> 1,1 <2, or $ {__ jexl3 (2> 1     ,)}

> =, <= Greater than or equal or less, such as 2> = 1, or $ {__ jexl3 (2> =  1,)}

! =,! It is not equal to, non as "y"! = "N" , the non-taken! = Counter value

Multi Available conditions: || or, && and, such as: 2 <5 && 2> 1 , $ {__ jexl3 (2 <5 && 2> 1,)}

Further, if the character string in quotation marks must use variables that are in the form of a string, such as: $ {__ jexl3 ( "$ {ischildren}" == "y",)}

 

Share it here today, that many instructions, the test task, but also at work.

 

Guess you like

Origin www.cnblogs.com/sandymonk/p/11506222.html