gpt4 book ai didi

jmeter - httprequest 帖子正文中的变量

转载 作者:行者123 更新时间:2023-12-03 01:36:44 28 4
gpt4 key购买 nike

我正在尝试生成一个 jmeter 脚本,其中每次运行脚本时都会创建一个唯一的文件夹 - 将某种变量添加到文件夹名称中,例如用户名+时间戳,应该足以保证唯一性。然而,jmeter 并没有将变量解析为其值 - 尽管这是从 csv 文件中读取变量时进行的(这是不合适的)。

基本上,我正在编辑http请求中的PostBody,如下所示:

 {"alf_destination":"workspace://SpacesStore/90368635-78a1-4dc5-be9e-33458f09c3f6","prop_cm_name":"Test
Folder - ${variable}","prop_cm_title":"Test
Folder","prop_cm_description":"Test Folder"}

其中 variable 基本上是我迄今为止尝试过的任何变量(例如随机字符串、时间戳等)

有人可以建议如何解决变量吗?

最佳答案

可以使用jmeter(2.9版本起)uuid功能->http://jmeter.apache.org/usermanual/functions.html#__UUID

${__UUID}

1) If you want just 1 value for the whole test, add a "User Defined Variables" Config Element to your test. This will be evaluated when you load the test script the first time.

2) If you want to have the value change for every thread execution, but stay the same during each thread instance: under your 'Thread Group', add a 'Pre Processors -> User Parameters' to your thread group - and add the variable there.

Also, if you want the value to change each time the thread starts over (each 'iteration' of the script within the thread group), you can check the "Update Once Per Iteration" box on the User Parameters - and it will get a new value each time it starts the thread over at the beginning of th test script (within that thread group).

http://mail-archives.apache.org/mod_mbox/jmeter-user/201208.mbox/%3C004301cd853e$0c4a60c0$24df2240$@gmail.com%3E

关于jmeter - httprequest 帖子正文中的变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15772122/

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