Refreshing Auth Token while keep the requests running in JMeter 3.3

5.9k views Asked by At

I have the following scenario using Jmeter 3.3:

I would like to run "Get auth token" once every 2.5 minutes and meanwhile to run [GET] thread group non stop.

In other words, [GET] is taking the auth token from the first thread group and I would like to run them in parallel and only change the token once at 2.5 min.

I tried to add a Constant Timer to the first thread but the second thread is not running until the timer passed.

How can I keep the [GET] running non-stop and "Get Auth token" only once at 2.5min?

LE:

[GET] Thread is used for load tests and should be run with ~100 active users (all using the same token)

Constant Timer was added under HTTP Sampler

> Get Auth token
>> [POST] Auth token
>>> HTTP Header Manager
>>> Regular Expression Extractor
>>> Response Assertion
>>> Constant Timer

LE2: I have tried adding a Test action under the first thread group. I did not manage to make Thread 2 run without waiting after Thread's 1 delay.

1

There are 1 answers

1
Dmitri T On BEST ANSWER

As per Functions and Variables User Manual chapter

Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.

So I would suggest converting your authToken into a JMeter Property via __setProperty() function in Get auth token Thread Group and refering the value in Get Thread Group using __P() function so once the authToken value is updated all the threads will be using the new value instead of the old one.

More information: Knit One Pearl Two: How to Use Variables in Different Thread Groups