Reputation: 11
So I couldn't find an answer to this yet.
In JMeter:
I have 2 controllers, 1 loop and 1 while controller.
In the loop I create several objects. The system I create objects in gives them each an ID.
I want to store these IDs and reuse them later in the while controller and iterate through them all to perform an action on them.
I don't want to save to file, because I find that messy. I would like to store them in variables using beanshell.
Who can help me with this challenge? :)
Upvotes: 1
Views: 1423
Reputation: 11
So basically, I did json path extraction in my loop controller and then store them in an arraylist using beanshell.
Then I used a forEach controller to iterate through that list.
It's messy but the best option available!
Upvotes: 0
Reputation: 168197
All Beanshell test elements come with vars
shorthand which stands for JMeterVariables class instance.
vars.put("variable_name", "variable_value");
vars.get("variable_name");
See How to Use BeanShell: JMeter's Favorite Built-in Component to learn more about using JMeter and Java APIs in from Beanshell test elements.
Upvotes: 1