Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining scope based user defined variables under different thread group

I have multiple thread group for a test plan in jmeter. I want to define user defined value's to a particular thread group, the variable name can be repeated in another thread group for its user defined values.

When I tried doing the above it was picking up the last value of the same variable name across thread groups and not using it scope wise.

Using for jdbc requests with queries

like image 645
Mobeen Shaikh Mob App Dev. Avatar asked Nov 01 '25 15:11

Mobeen Shaikh Mob App Dev.


1 Answers

I answere this "old" question for everyone who has the same Problem and is looking for a working solution. At least in JMeter 5.11 the answer of Dmitri T is not always true.

From the JMeter Documentation:

  • Note that the values defined by the Test Plan and the User Defined Variables configuration element are made available to the whole test plan at startup. If the same variable is defined by multiple UDV elements, then the last one takes effect. Once a thread has started, the initial set of variables is copied to each thread. Other elements such as the User Parameters Pre-Processor or Regular Expression Extractor Post-Processor may be used to redefine the same variables (or create new ones). These redefinitions only apply to the current thread.

A good and working solution for using local variables, that are only visible in the actual Thread Group, is to use the User Parameters Pre-Processor instead of the User Defined Variables configuration element.

Happy load testing ...

like image 127
James Avatar answered Nov 04 '25 13:11

James



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!