问题描述
是否有一种方法可以在BeanShell侦听器脚本中确定示例结果/事件是否在事务控制器下?
Is there a way to determine in a BeanShell Listener script if a Sample Result/Event is under a Transaction Controller?
我知道您可以使用sampleEvent.isTransactionSampleEvent()
确定事件是否用于TransactionController.但是,在下面的示例中,是否可以在对HTTP请求2执行BeanShell侦听器时检查它是否在事务控制器下?
I know you can use sampleEvent.isTransactionSampleEvent()
to determine if the event is for TransactionController. But is it possible to check, in the below example, when executing the BeanShell Listener for HTTP Request 2, if it is under Transaction Controller?
Thread Group
HttpRequest 1
TransactionController
HttpRequest 2
HttpRequest 3
HttpRequest 4
推荐答案
为什么不使用后缀(-underTC)命名采样器,并在监听器中对其进行测试:
Why not name your sampler with a suffix (-underTC) and test this in your listener:
- JMeterContext#getCurrentSampler()#getName()
尝试使用内部JMeter API可能会在将来破坏您的测试.
Trying to use internal JMeter API might break you Test in the future.
这篇关于JMeter-在Beanshell侦听器中检测TransactionController采样器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!