虽然我找到了 similar question,答案并不令人满意,或者在我的情况下也不起作用。
我有N个没有线程在假设5的加速期间运行.N个用户的登录验证正在从CSV文件传递。 监听器的报告显示线程38或任何其他线程在线程1之前运行,即第一次迭代是线程否X(其中X!= 1)。使用循环控制器似乎不是解决方案,因为我的N个用户都是不同的。以下是我测试的测试报告。
Thread Iteration Time(milliseconds) Bytes Success
ThreadNo 1-38 1 94551 67485 true
ThreadNo 1-69 2 92724 67200 true
ThreadNo 1-58 3 91812 66332 true
ThreadNo 1-12 4 92144 66335 true
ThreadNo 1-18 5 91737 66340 true
ThreadNo 1-17 6 93055 66514 true
所以我希望我的迭代1以线程1(ThreadNo 1-1)开始。
更新:
我的测试计划连续运行线程组(即一次运行一个组)
已选中。
的快照以下是jmeter日志
jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-39
2015/12/14 02:00:37 INFO - jmeter.threads.JMeterThread: Thread finished: ThreadAction 1-39
2015/12/14 02:00:37 INFO - jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-49
2015/12/14 02:00:37 INFO - jmeter.threads.JMeterThread: Thread finished: ThreadAction 1-49
2015/12/14 02:00:37 INFO - jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-38
2015/12/14 02:00:37 INFO - jmeter.threads.JMeterThread: Thread finished: ThreadAction 1-38
2015/12/14 02:00:38 INFO - jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-41
2015/12/14 02:00:38 INFO - jmeter.threads.JMeterThread: Thread finished: ThreadAction 1-41
2015/12/14 02:00:38 INFO - jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-42
2015/12/14 02:00:38 INFO - jmeter.threads.JMeterThread: Thread finished: ThreadAction 1-42
2015/12/14 02:00:38 INFO - jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-34
2015/12/14 02:00:38 INFO - jmeter.threads.JMeterThread: Thread finished: ThreadAction 1-34
2015/12/14 02:00:39 INFO - jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-47
2015/12/14 02:00:39 INFO - jmeter.threads.JMeterThread: Thread finished: ThreadAction 1-47
2015/12/14 02:00:39 INFO - jmeter.threads.JMeterThread: Thread is done: ThreadAction 1-40
答案 0 :(得分:2)
我会告诉你一个小秘密: JMeter确实按顺序启动线程,你不需要采取任何额外的行动。如果您查看 jmeter.log 文件,您会看到类似
的内容log.info("使用主题号执行请求:" +参数);
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-2
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-3
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-4
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-5
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-6
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-7
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-8
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-9
2015/12/15 18:35:31 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-10
您在测试报告中看到的似乎是请求完成时间,该时间应该仅在理想世界中是顺序的。
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-45
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread is done: Thread Group 1-47
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-47
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-46
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread is done: Thread Group 1-50
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-50
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread is done: Thread Group 1-49
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread is done: Thread Group 1-48
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-48
2015/12/15 18:39:04 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-49
如果您仍然需要某个原因在第一次迭代时让第一个线程执行某个采样器 - 将其放在If Controller下并使用以下语句作为"条件"
${__BeanShell(vars.getIteration() == 1)} && ${__threadNum} == 1
它使用以下JMeter函数: