0

I have defined variable Total_users=100 in test plan and i have four thread group.
ThreadGroup1:- Dashboard(50% of total users),
ThreadGroup2:- Order(10% of total users),
ThreadGroup3:- Shipments(20% of total users),
ThreadGroup4:- Profile(20% of total users).

I want to change the variables value only in test plan and values should get reflected in thread group automatically. How can i do that ?

I tried ${__jexl(vars.get("Total_users")*0.5)} for dashboard but not found any solution.

0

You can add a Beenshell Preprocessor to run arbitrary code before the thread group. In it, you can access JMeter variables.

// Note: JMeter variables are Strings 
// you will need add some casting for and to Integer
vars.put(
   "currentNumberOfUsers",
   vars.get("Total_users") * 0.5
);

Then you can access currentNumberOfUsers on the ThreadGroup that needs half the users.

0

Since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting so consider using __groovy() function, the relevant syntax would be:

${__groovy((vars.get('Total_users') as int) / 2)}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.