3

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
Riadh Belkebir
  • 797
  • 1
  • 12
  • 34
ycr
  • 12,828
  • 2
  • 25
  • 45
  • I can't seem to find any way to do this. You can get the *current* Sampler (`ctx.getCurrentSampler()`), but as far as I can tell, there isn't a way to get a Test Element's Parent. I suspect that's a design choice. – RowlandB Jun 27 '16 at 19:54
  • I did R&D on this. I second RowlandB. This does not seem possible because of design limitations in JMeter. – TestingWithArif Jun 28 '16 at 09:41

2 Answers2

2

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:

Parent Simple Controller Name

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

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

This jmeter function help you.

getParent()

As in:

format(new Date(prev.getStartTime()))+","+prev.getTime()+","+prev.getParent()+" \n\n")).close();
Ouroborus
  • 16,237
  • 4
  • 39
  • 62