3
votes

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

3

3 Answers

3
votes

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 ...

0
votes

JMeter Variables have scope limited to current Thread Group only. To make JMeter variables visible for all Thread Groups you need to convert them to JMeter Properties. See How to Use Variables in Different Thread Groups guide for details on how to do it.

0
votes

I got the solution. Example: If you have some test cases under a random order controller and like that you have multiple random controllers. The test case's contain a variable name for a jdbc request connection then you can add user defined variable inside the random order controller which will be used by only those test case's under it. Like this you can scope the variable name to a particular random order controller