0
votes

I am working on setting up a way to do a performance test for the rest API's using Jmeter which includes token expiry for every three minutes.

1.)Currently, I created two thread groups one for making a call to get "access_token" and setting into the property using Bean shell assertion setProperty, to be used in other thread Groups. 2.)I could see Second thread group can access the value set in the first step.

But my goal is to execute the first thread group every 2min 30 seconds continuously so that the second thread group can get the new token every 2 min 30 seconds.

I tried a constant timer, but didn't seem to work is there any way to do this or any other timer to use to achieve this token refresh?

Thanks in advance

1

1 Answers

1
votes

The Constant Timer should work, but be aware that it creates a delay before each Sampler it it's scope so it might be the case your setting it up wrong, you can use i.e. a Dummy Sampler and put the Constant Timer as a child of the Dummy Sampler, this way your HTTP Request to get token will be executed, followed by the delay defined in the Constant Timer, followed by the Dummy Sampler, et.c

Example setup:

enter image description here

You might find Flow Control Action sampler easier to use

enter image description here

Also be aware that starting from JMeter 3.1 you're supposed to be using JSR223 Test Elements and Groovy language for scripting. Moreover it's not required to write any code, you can go either for __setProperty() and __P() functions combination or for Inter-Thread Communication Plugin