如何在Jmeter中同步两个线程组

如何在Jmeter中同步两个线程组,jmeter,Jmeter,使用Jmeter,我想实现如下目标: Thread Group 1 - Http Request 1 - Set P1 to "true" - Wait synchronization with Thread Group 2 (parameters P1 and P2 are both "true") - Http Request 2 Thread Group 2 - Http Request 1 - Set P2 to "true" - Wait synchronization

使用Jmeter,我想实现如下目标:

Thread Group 1
 - Http Request 1
 - Set P1 to "true"
 - Wait synchronization with Thread Group 2 (parameters P1 and P2 are both "true")
 - Http Request 2

Thread Group 2
 - Http Request 1
 - Set P2 to "true"
 - Wait synchronization with Thread Group 1 (parameters P1 and P2 are both "true")
 - Http Request 2
这基本上与前面描述的相同:我将P1和P2设置为“true”,如下所示(HTTP请求/BeanShell都可以工作):

我的问题是如何实现等待条件。我已经尝试了while控制器退出状态的所有可能组合,但无法实现我想要的。奇怪的是,放置在循环中的调试采样器(或带有log.info的beanshell)向我显示属性P1和P2设置正确(退出条件满足我的预期),但它无论如何都不会退出。例如,我尝试过:

${__property("P1")}!="true"||${__property("P2")}!="true"
${__property(P1)}!="true"||${__property(P2)}!="true"
${__property(P1)}=="true"&&${__property(P2)}=="true"
${__property("P1")}=="true"&&${__property("P2")}=="true"

有人能帮我吗?提前谢谢

请参阅此处理线程间通信的组件:


诀窍是在while条件下使用u BeanShell函数:

${__BeanShell((${__property(P1)}!="true"||${__property(P2)}!="true"}
此外,While控制器不能为空(您必须添加一个采样器或类似的东西,否则它将被跳过)

${__BeanShell((${__property(P1)}!="true"||${__property(P2)}!="true"}