如何让线程根据Jmeter上的计数器执行
我有 4 个不同的线程组,我们称它们为 testA、testB、testC 和 testD。
testA 有 100 个循环,也可能是无限的。我需要 testB 在 testA 的每 3 个循环上执行,testC 在 testA 的每 10 个循环上执行。
我有计数器来计算每次测试下的循环次数。我该怎么做呢?我是否在每个测试上方放置一个 If 控制器?如果是这样,我应该在每个 if 控制器上放置什么,或者有更好的方法吗?谢谢!
I have 4 different thread groups, let's call them testA, testB, testC, and testD.
testA has 100 loops or it could be infinite. I need testB to execute on every 3rd loop from testA and testC to execute on every 10th loop from testA.
I have counters to count the number of loops under each test. How would I go with doing this? Do I put an If Controller above each test? If so, what do I put on each if controller, or is there a better way? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您只需将 If Controller 放入
testA
中。当谈到“放什么”时 - 我会选择 __groovy() 函数${__groovy(vars.getIteration() % 3 == 0,)}
- 用于执行每个第三个循环${__groovy(vars.getIteration() % 10 == 0,)}
- 用于执行每个第 10 个循环现在的问题是如果您想要顺序执行,在 If 控制器下放置什么 - 去模块控制器将从 testB 调用采样器,如果您想要并行执行 - 请使用 线程间通信插件
I think you need to put If Controller in
testA
only. When it comes to "what to put" - I would go for __groovy() function${__groovy(vars.getIteration() % 3 == 0,)}
- for executing each 3rd loop${__groovy(vars.getIteration() % 10 == 0,)}
- for executing each 10th loopNow the question is what to put under the If Controller, if you want sequential execution - go for Module Controller which will call the Samplers from testB, if you want parallel execution - go for Inter-Thread Communication Plugin