gpt4 book ai didi

jmeter - Jmeter 中的每次迭代中未更新变量值

转载 作者:行者123 更新时间:2023-12-05 02:39:26 32 4
gpt4 key购买 nike

我在我的脚本中使用时间戳作为值,以使其在每次迭代中保持唯一和可区分。我正在使用 ${__time(/1)} 函数并将其存储在事务 Controller 内的用户定义变量中,然后在其他事务和 json 有效负载中使用相同的变量。这适用于单次迭代。

我预计在每次迭代中时间戳都会更新。但我可以看到在每次迭代中都使用了相同的时间戳。我怎样才能让它在每次迭代中更新时间戳,因为我只需要在一次迭代中使用一个时间戳值,而不是在连续的迭代中重复。 using user defined variables with timestamp function

output

same value in each iteration

最佳答案

User-Defined Variable配置元素在开始时只处理一次。它在测试计划之后进行处理。它不适合您的用例。

UDVs should not be used with functions that generate different results each time they are called. Only the result of the first function call will be saved in the variable.

可能有多种选择。

  1. 使用User Parameters预处理器 enter image description here

您可以设置每次迭代更新一次以满足您的要求。

  1. 使用Set Variables Action插件

enter image description here

  1. 在 JSR223 预处理器中设置值您可以将 Controller 放在测试计划下方。

enter image description here

关于jmeter - Jmeter 中的每次迭代中未更新变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69145128/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com