Refreshing Auth Token while keep the requests running in JMeter 3.3

て烟熏妆下的殇ゞ 提交于 2020-01-15 10:23:28

问题


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:


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



来源:https://stackoverflow.com/questions/48748594/refreshing-auth-token-while-keep-the-requests-running-in-jmeter-3-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!