How to get the name of the Parent Controller from a Post Processor

你说的曾经没有我的故事 提交于 2019-12-06 09:58:34

问题


My Jmeter Project Structure is like following, and I have a Beanshell Post Processor as a child node. How can I get the name of the Parent controller(Simple Controller 01) from the BeanShell post processor? Your help is highly appreciated.

 Thread Group
  |
  |_ Simple Controller 01
  |__ Sampler 01
  | |__ Beanshell Post Processor
  |__ Sampler 02
  |
  |_ Simple Controller 02
  |_ Sampler 03

回答1:


Directly it is not possible due to JMeter API design limitations so I'd suggest to redesigning your test plan so you would know parent controllers name.

Indirectly you can figure that out by getting access to the HashTree structure representing JMeter Test Plan using Reflection:

Remember, any time you bypass Java limitation using Reflection somewhere somehow a kitten dies, so think one more time, most probably you won't need to play this trick.

More information on using Beanshell in JMeter: How to Use BeanShell: JMeter's Favorite Built-in Component



来源:https://stackoverflow.com/questions/38049627/how-to-get-the-name-of-the-parent-controller-from-a-post-processor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!