I'm working on testing some API's (10-15 in number) that uses Bearer token for authentication. The token has an expiration condition post which I have to re-generate the token. I've not worked on this situation on Jmeter so looking for answers how this can be done.
- At start of tests, generate the Token
- Use the token in API's for let say 5 users
- If the following conditions are met, re-generate token
- If the token has been used 50 times
- If the token timeout period is reached, which is 10 minutes.
As per my understanding, if I am creating 5 threads for the API tests, and passing the Token to these 5 threads, then the first condition gets reached once there are 50 requests made and so I have to re-generate the token mid test and use that again.
Is this achievable in Jmeter? I've see couple of examples where the second condition regarding timeout can be done, but here I have two separate conditions?
OS - Not sure if this needs to be done via Groovy scripting as I have never worked on a groovy script before.