Search code examples
jmeterjmeter-5.0

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.


Solution

    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