Scenario:
exec{
http("Save Request").
post(requestUrl).
body(StringBody("${request}")).
asJSON.
check(
status.is(201),
jsonPath("$.id").findAll
.saveAs("requestId")
)
}
.exec {
http("Save Request2").
post(postUrl).
body(StringBody("${request2}")).
asJSON.
check(
status.is(200)
)
我必须将exec1中保存的值“requestId”传递给exec 2的主体中的参数,即
val testData: Iterator[Map[String, String]] = Iterator.from(1, 50).map(i => Map(
"request2" -> Json(Map(
"context" -> "REQUEST",
"contextId" -> "${requestId}"))