Reputation: 55
In J meter I have 2 Thread from Ist thread I am getting token value and I have to use that into 2nd thread header manager. The value generated is in JSON so, I have used JSON extractor to extract the value of that token but I am not able to use that value into Next(2nd Thread)
Thread 1: JSON extractor I have used $..token to extract my token value and stored into a variable 'X' as in JSON Extractor there are one field names of created variables.
Thread 2: Header manager -->> I want to use that value with one word 'YY' so it should be like 'YY (token value)'
For the above one I have tried YY+{X} it's not working for me and also YY {X} it is also not working.
SO kindly help me in this.
Upvotes: 0
Views: 540
Reputation: 26
First at all, ensure you're running your threads consecutively (Check 'Run Threads Consecutively' in Test Plan properties)
Easiest way to share variables between threads is to use 'Properties', In your example after you have extracted the variable 'X' create an assertion or post processor of your preference(i use beanshell assertion), and copy this: ${__setProperty(paramToAnotherThread,${X})}.
Then in the other thread use ${__property(paramToAnotherThread)} to invoque it.
Hope it works.
Here you can see explained: https://www.blazemeter.com/blog/knit-one-pearl-two-how-use-variables-different-thread-groups
Upvotes: 1