本文介绍了如何在Gatling脚本中的下一个请求中传递相关值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何用"request_1"中的相关值"SynchToken"替换"request_2"中的"details1".我正在尝试用$ {SynchToken}代替,但它不反映相关值.
How can I replace "details1" in "request_2" with correlated value "SynchToken" from "request_1". I am trying to replace with ${SynchToken} but it is not reflecting the correlated value.
val Transaction_Name_1 = group("Transaction_Name_1") {
exec(http("request_1")
.get(session => "/abc/details1?_=" + System.currentTimeMillis())
.check(regex("""name="SYNCHRONIZER_TOKEN" value="(.*?)"""").saveAs("SynchToken")))
.pause(5)
.exec(http("request_2")
.get(session => "/abc/details1?_=" + System.currentTimeMillis()))
}
推荐答案
您应该花一些时间阅读文档.在这里,您需要使用会话API .
You should really spend some time reading the documentation.Here, you need to use the Session API.
exec(http("request_2")
.get(session => "/abc/" + session("SynchToken").as[String] + "?_=" + System.currentTimeMillis()))
这篇关于如何在Gatling脚本中的下一个请求中传递相关值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!