Hi team,
I am looking for a solution for the below problem.
For my K6 test I am getting the token and saving it in a file using puppeteer ( node gettoken.js which I am running separately before starting my test). My main test has 9 scenarios which test different api calls. My first scenario is a vu_setup where it reads the token from the file and set the header details for all the virtual users I use for my scenarios. This is all working fine until my token expires. Is there any solution I can use to reset my token may be after every 30 minutes by running node gettoken.js file?
Thanks.
Hi @blrvandana !
There are multiple ways of doing that, but the most straightforward is to inject the logic that will ensure the token isn’t expired and, if needed, renew it.
There are multiple topics around the community forums, so I’d recommend checking them:
- Generated Token every 10 mins and use it during load test - #27 by bandorko
- Setup function duration - #2 by mstoykov
- Periodically refreshing a token aside a script
Let me know if that answers
Cheers!