Search code examples
multithreadingjmeterruntimetoken

JMeter: How to utilize token generated at runtime on multiple thread groups


Scenario is we are generating token during execution which would further be used in other threadgroup.

Like:

In first thread group, tokens will be generated for 100 users. In second thread group, 50 users will utilize the tokens. In third thread group, next 50 users will utilize the tokens.

Query is: 1. How do we save tokens that is generated during run time? 2. How to use first 50 tokens on second thread group and rest other 50 on third thread group?


Solution

  • If you need to use a Token generated by a request in following requests then use 1 Thread Group and not many.

    Threads in different ThreadGroup have absolutely no relation and are considered as different users, so although you may use elements like InterThreadCommunication to do that, just DON'T.

    If you use same thread group then it's just a matter of using the correct extractor to generate variables and then use them using ${varName}.