Wiremock - 使用响应正文中的随机值到 postServeActions

问题描述 投票:0回答:1

这是 __admin/mappings: 我有这样的回应: “回复”: { “状态”:200, "headers":{"Content-Type" : "application/json"}, "body": {"transactionID": "{{randomValue length=12 type='NUMERIC'}}","statusCode": "S01"} }

我想在 postServeActions 中使用相同的随机数。我该如何通过?

"postServeActions" : 
 [{
    "name" : "webhook",
"parameters" : {
"method" : "POST",
"url" : "http://127.0.0.1:8081/sts/ADD?FILENAME=transactions.txt&LINE=<transactionID>&ADD_MODE=FIRST&UNIQUE=TRUE"
    }
}]

(没试过)

jmeter wiremock
1个回答
0
投票

如果您的问题与 Wiremock 相关,根据 响应模板 - 随机值,您应该能够使用以下内容:

{{randomValue length=10 type='NUMERIC'}}

如果你想在 JMeter 中做同样的事情,你可以使用 __Random() 函数

${__Random(1000000000,9999999999,)}

有关 JMeter 函数概念的更多信息:Apache JMeter 函数 - 简介

© www.soinside.com 2019 - 2024. All rights reserved.