在 JMeter 3.3 中保持请求 运行 的同时刷新 Auth Token

Refreshing Auth Token while keep the requests running in JMeter 3.3

我有以下使用 Jmeter 3.3 的场景:

我想运行“Get auth token”每2.5分钟一次,同时运行[GET]线程组不停。

换句话说,[GET] 正在从第一个线程组获取身份验证令牌,我想 运行 它们并行并且只在 2.5 分钟更改一次令牌。

我试图将常量计时器添加到第一个线程,但第二个线程在计时器过后才 运行ning。

如何才能让 [GET] 运行ning 不间断并且“Get Auth token”只在 2.5 分钟时出现一次?

LE:

[GET] 线程用于负载测试,应该 运行 有大约 100 个活跃用户(都使用相同的令牌)

在 HTTP 采样器下添加了常量计时器

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

LE2: 我尝试在第一个线程组下添加一个测试操作。在线程 1 延迟后,我没有设法创建线程 2 运行。

根据 Functions and Variables 用户手册章节

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.

所以我建议通过 __setProperty() function in Get auth token Thread Group and refering the value in Get Thread Group using __P() function 将您的 authToken 转换为 JMeter 属性 因此一旦更新 authToken 值,所有线程都将使用新值而不是旧的。

更多信息:Knit One Pearl Two: How to Use Variables in Different Thread Groups