.exec(_.set("valuesperf", List.empty[String])
.foreach("#{ArrayValues}", "VValues") {
exec(http("perftest values")
.post("perftest")
.body(StringBody(session =>
s"""{
|"id": "",
|"perfTypeId": "00334-0000-0000-0345",
|"legs":[{
| "valueTypeId": "111-220-3300-0444",
| "values": "${session("VValues").as[String]}"
| }]
| }""".stripMargin)).asJson
.check(jsonPath("$.id").saveAs("perfvalue_singlevalue"))
.check(status.is(201)))
.exec(_.set("valuesperf", session("perfvalue_singlevalue").as[String] :: session("valuesperf").as[List[String]])
}).exec(session => {
println(session("valuesperf").as[List[String]].mkString(", ")) // only to show the resulting value
session
})
.exec(http("Bulk_perftest")
.delete("/perf/bulk")
.body(StringBody(session => s"""["${session("valuesperf").as[List[String]].mkString("\", \"")}"]"""))
.check(status.is(204)))
Notes:
-
sessionis immutable, you have to return the updated value - preprend the list with the current value
- use the accumulated list for the final request
Cheers!