Ayush
Ayush

Reputation: 623

How to handle refresh token in Jmeter

I have a setup thread group to authenticate and set a auth header property. The next thread group is for http request (the thread groups runs sequentially). However, after 15 minutes, I will need to refresh the token.

I don't want to send multiple authenticate request un-necessarily. Is there any way, I can add two thread groups and have only the auth request re-run every 10 minutes whereas the other http request run repeatedly.

Upvotes: 1

Views: 5898

Answers (2)

Mikal
Mikal

Reputation: 21

you can use also a Runtime Controller here. Put all the requests you want to run for 10 minutes into runtime controller and set the duration value to 10 minutes. Then you need to control the rest of the script on your own. If your script comes to end it will start again from top and so the token will be renewed.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168082

  1. Run Thread Groups in parallel
  2. Make the "token" Thread Group to loop forever
  3. Ensure that "token" request is being executed each 10 minutes by adding Flow Control Action sampler configured to sleep for 9 minutes 50 seconds or something like this
  4. Token can be passed from one thread group to another using __setProperty and __P() functions or Inter-Thread Communication Plugin

Upvotes: 4

Related Questions