【P31】JMeter loop controller (Loop Controller)


1. Loop Controller parameter description

可以对部分逻辑按常量进行循环迭代

Right-click on the thread group >>> Add >>> Logic Controller >>> Loop Controller

insert image description here

  • Loop Count: Set the number of times to run, Infinite is checked to run forever

2. Test plan design

2.1, set the number of cycles

(1), right click on the test plan <<< add <<< thread (user) <<< thread group

insert image description here

  • The parameters are default

(2), right click on the thread group <<< add <<< sampler <<< debug sampler

insert image description here

  • Name: Debug Sampler-1

(3), right click on the thread group <<< add <<< logic controller <<< cycle controller

insert image description here

  • Number of cycles: 5

(4), right click on the cycle controller <<< add <<< sampler <<< debug sampler

insert image description here

  • Name: Debug Sampler-2

(5), right click on thread group <<< add <<< listener <<< view result tree

(6) Click to start, click to view the result tree to view

insert image description here

如图,循环控制器下的 调试取样器-2 执行了5次

2.2, check forever

(1), modify the loop controller, check forever

insert image description here

(2), click to clear all, click to start, click to view the result tree to view

insert image description here

如图,循环控制器下的 调试取样器-2 会一直运行

2.3. Set the duration of the thread group

(1) Modify the thread group, check the scheduler, and set the duration to 3

insert image description here

  • Check the scheduler

  • Duration (seconds): 3

(2), click to clear all, click to start, click to view the result tree to view

insert image description here

如图,执行3s后,会停止,虽然循环控制器勾选了永远,但是因为线程组设置了持续时间,所以按照线程组的持续时间执行

Guess you like

Origin blog.csdn.net/qq_45138120/article/details/130874072