Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

JMeter does not pass token when executed in non-gui mode

I have two threads groups. The first one generate a token that is passed to the second thread group. I use a json extractor and a beanshell assertion in the first group to make the token visible for the second thread. It works perfectly in gui mode but in non-gui mode the token always is generated correctly but is not passed to the second thread so it fails, returns status 401.

Do you have any idea why this happen and a solution?

Edit:
I have a global user defined variable element. There I have a var called token_type with the value global_token.
Then in the second thread I have a http header manager where I have a header called Authorization with the value Bearer ${__V(${token_type})}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

  1. Since JMeter 3.1 it’s recommended to use JSR223 test elements and Groovy language for scripting so consider migrating
  2. Unless you have a very specific use case it would be a better idea to move samplers into a single Thread Group, this way you won’t have to pass the token between thread groups at all, moreover each thread (virtual user) would have its own token as JMeter Variables are local to the threads
  3. You may find Inter-Thread Communication plugin easier to use, in this case the 2nd thread group will "wait" until the token becomes available
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading