Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

JMeter Interface Test-if Controller

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

JMeter Interface Test-if Controller

Use the scene:

Pay only when the user logs in to the business scenario, and click to pay if you don't log in.

The page jumps to the login page. The same is true for interfaces. Before an interface needs to be executed, there need to be prerequisites, such as zero state execution and 1 state execution, so it needs to be judged by the if controller. The benefits are self-evident.

If Controller (If Controller):

Function: determines whether to execute the child nodes under the node according to the value of the given expression.

Add if controller, right-click thread group-> add-> logic controller

Set user parameters

Here is an example of the user parameter ID=1234. The API http requests execution, otherwise it will not be executed. Drag and drop the API you need to control into the if controller

If controller parameters:

Condition: judgment statement

Interpret Condition as Variable Expression?): check this to indicate whether the value of the variable is equal to the string true (case-insensitive)

Evaluate for all children: if this item is selected, the expression is evaluated before each child node executes

At present, I change the judgment to ID=1231. Depending on the implementation, I will clear the last record before execution.

Our condition (id=1231) is actually passed into the id=1234. The request within the If Controller is not executed and returns false.

In the view result tree, you can see that the http request interface is not executed, which is consistent with the expected result.

Next, let's take a look at the id=1234 and check the results.

From the result tree, we can see that the http request interface is executed, and the if controller makes a good judgment.

If controller can also be used in combination with multiple conditions.

And combination conditions:

Or combination of conditions:

The controller is simple and easy to use, the grammar is easy to read and understand, and there are other rich formats for conditional statements, so learn it quickly!

Recommended reading content selection recommended

JMeter database operation

Jmeter Interface Test-regular expression

JMeter returns garbled code in Chinese

Jmeter interface testing-parameterization

JMeter Interface testing-Basics

Test-impression

Add Wechat to the consulting work

scan a QR code

Welcome self-recommendation and recommendation, need Wechat to push resume!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report