How to store value of all request in an array of one thread group and use in other thread group?

33 Views Asked by At

So I have 2 thread groups say T1 and T2. T2 runs with a delay of 30s from T1. I want to store a request parameter of all http request of T1 in an array and use it iteratively in T2. Is there a way to do it in jmeter?? I have tried using beanshell but that is not working for me.

Any help will be appreciated.

Thanks in advance

I tired using beanshell and JSR223 postprocessor. They initialize the array in every request and only 1 value goes in array.

1

There are 1 best solutions below

0
On

We cannot help you without seeing your "parameters" and your code.

Example one you can use or amend according to your needs:

def array = props.get('array') ?: new ArrayList()

sampler.getArguments().each {argument -> array.add(argument.getName() + '=' + argument.getObjectValue() as String)}

props.put('array',array)

and in 2nd Thread Group you can access it as:

def array = props.get('array')

Also please reconsider using Beanshell because it's some form of a performance anti-pattern, you should be using JSR223 Test Elements and Groovy language for scripting. More information: Beanshell vs. JSR223 vs. Java For JMeter: Complete Showdown