0
  1. In Regular Expression Extractor I have stored reference name as prasad.

  2. If I give my reference name to further scripts ${prasad} where ever I want it is working fine.

  3. But I want to store these reference name as user defined variables (Global variables).

  4. I am using only one thread group.

  5. I am doing performance automation scripts so I want to store that reference name as user defined variable.

I didn't not understand properly,(Below Answer)..Can any one help me with brief explanation please...

Vinod
  • 2,263
  • 9
  • 55
  • 104
  • Why you need it as user defined variables ? See https://stackoverflow.com/questions/707832/how-do-i-pass-a-variable-from-one-thread-group-to-another-in-jmeter – Ori Marko Aug 12 '17 at 18:12
  • There's no such thing as "global variables" in JMeter. The only difference between what you have and "user defined variables" is that "user defined variables" are initialized with some value before script started to run. If your goal is to pass data between threads or thread groups, look at properties – timbre timbre Aug 13 '17 at 03:59
  • If there is only one thread group, why do you require a "global variable"? – M Navneet Krishna Aug 14 '17 at 04:07

1 Answers1

2

This is stated in JMeter's best practices or mailing list answer:

Variables are local to a thread; a variable set in one thread cannot be read in another. This is by design. For variables that can be determined before a test starts, see Parameterising Tests (above). If the value is not known until the test starts, there are various options:

Store the variable as a property - properties are global to the JMeter instance

To store in JMeter's "global variable"/property add JSR223 Sampler

props.put("a", vars.get("a"));

Now you can see you "global" variable ${a}

Ori Marko
  • 56,308
  • 23
  • 131
  • 233