This article directory
1. Loop Controller parameter description
可以对部分逻辑按常量进行循环迭代
Right-click on the thread group >>> Add >>> Logic Controller >>> Loop Controller
- 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
- The parameters are default
(2), right click on the thread group <<< add <<< sampler <<< debug sampler
- Name: Debug Sampler-1
(3), right click on the thread group <<< add <<< logic controller <<< cycle controller
- Number of cycles: 5
(4), right click on the cycle controller <<< add <<< sampler <<< debug sampler
- 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
如图,循环控制器下的 调试取样器-2 执行了5次
2.2, check forever
(1), modify the loop controller, check forever
(2), click to clear all, click to start, click to view the result tree to view
如图,循环控制器下的 调试取样器-2 会一直运行
2.3. Set the duration of the thread group
(1) Modify the thread group, check the scheduler, and set the duration to 3
-
Check the scheduler
-
Duration (seconds): 3
(2), click to clear all, click to start, click to view the result tree to view
如图,执行3s后,会停止,虽然循环控制器勾选了永远,但是因为线程组设置了持续时间,所以按照线程组的持续时间执行