0

I'm attempting to do load testing for Azure, and in doing so, I need to create a an 'EH Client' Object. I want this object to be reusable by all threads, since otherwise, the load testing happens a lot slower. I'm running into the following issues:

From my knowledge of JMeter, I believe that the only way I can do this is through props, not variables. However, I have found limited documentation and support on passing normal Java Objects as props, and have even heard that it is discouarged.

I'm not sure about where to put my JSR223 Sampler (which is using Java on Beanshell Engine) for this to happen. Ideally, I'd want this to be outside my main thread group, but doing so doesn't seem to work, as any attempts to access the object fail.

TL;DR: I want to create ONE Java Object using a JRS223 Sampler which can be used by all of my threads.

1 Answers1

1

As long as you don't iterate the Properties values() considering them all Strings - you should be good to save your Object into JMeter's props shorthand.

If you want to go for Beanshell - there is bsh.shared namespace which can be used for sharing the Objects between threads/thread groups.

If however you would like to avoid this as well you could use ObjectOutputStream to save your object into a file somewhere in the setUp Thread Group and read it back in "normal" Thread Group(s). See How to read and write Java object to a file article for more details.

Just one hint: don't use Beanshell, since JMeter 3.1 it's recommended to use Groovy language for scripting and java language uses Beanshell interpreter under the hood.

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