如何在 JMeter 中每 N 个循环增加一个计数器?
我想测试并发性,并可靠地复制 JMeter 引起我注意的问题。
我想要做的是设置一个唯一标识符(当前以毫秒为单位的时间并附加计数器)并在循环之间而不是线程之间增加计数器。我的想法是,我设置的线程数是在递增和使用另一个标识符之前相同标识符的数量。
如果我有 3 个循环计数为 2 的线程,我想要:
1. Unique ID: <current-time-in-millis>000000
2. Unique ID: <current-time-in-millis>000000
3. Unique ID: <current-time-in-millis>000000
4. Unique ID: <current-time-in-millis>000001
5. Unique ID: <current-time-in-millis>000001
6. Unique ID: <current-time-in-millis>000001
我尝试使用吞吐量控制器来增加计数器,以及其他一些看起来应该可以工作但没有运气的东西。这似乎是 JMeter 应该能够做到的事情。有什么方法可以获取循环计数的值吗?
I want to test concurrency, and reliably replicate an issue that JMeter brought to my attention.
What I want to do is set a unique identifier (currently the time in milliseconds with a counter appended) and increment the counter between loops but not between threads. The idea being that the number of threads I have set up is the number of identical identifiers before incrementing and using another.
If I had 3 threads with a loop count of 2 I want:
1. Unique ID: <current-time-in-millis>000000
2. Unique ID: <current-time-in-millis>000000
3. Unique ID: <current-time-in-millis>000000
4. Unique ID: <current-time-in-millis>000001
5. Unique ID: <current-time-in-millis>000001
6. Unique ID: <current-time-in-millis>000001
I've tried using Throughput Controllers to increment a counter, as well as several other things that seemed they should work but had no luck. This seems like something JMeter should be able to do. Is there any way to get the value of the loop count?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Counter 是解决方案吗?
或使用 __intSum
初始化变量(例如在“用户定义的变量”中):
使用增量无论您何时需要:
使用:
Is Counter the solution?
or use __intSum
init variable (eg in "User Defined Variables"):
use increment where ever you need:
using:
您是否尝试过使用预处理器计数器元素上的“为每个用户独立跟踪计数器”选项?
我的理解是,这应该为每个线程组提供一个单独的计数器。
Have you tried playing with the "track counter independently for each user" option on the pre-processor Counter element?
My understanding is that this should give you a separate counter for each thread group.