问题
I need two separate thread groups to be run(Second group have infinite loop count). And when the first group is done stop the second one. How can I determine when the first group is done?
回答1:
That's work for me:
- Crete "BeanShell PreProcessor" with this code:
props.put("DONE", "FALSE");
- Create "BeanShell PostProcessor" with this code:
int activeThreadCount = org.apache.jmeter.threads.JMeterContextService.getNumberOfThreads(); if (activeThreadCount <= 1) { props.put("DONE", "TRUE"); }
Add If Controller with:${__BeanShell( props.get("DONE") != null && props.get("DONE")=="TRUE")}
Stop Current Thread inside If Controller.
回答2:
You can attach a post-processor to the first threadgroup, which sets a flag value in a property.
Your second threadgroup will contain a loop until the property contains the flag value you are waiting for.
回答3:
You can use the following solution:
Thread Group 1
Beanshell Sampler - props.put("finish", "FALSE");
HTTP1
HTTP2
....
Beanshell Sampler - props.put("finish", "TRUE");
Thread Group 2
While Controller - ${__BeanShell( props.get("finish") != null || props.get("finish")=="TRUE" )}
HTTP1
HTTP2
....
Hope this will help.
来源:https://stackoverflow.com/questions/26465338/jmeter-how-to-determine-when-thread-group-is-finished