简体   繁体   中英

How to pass a list of values to gatling request

I save a list of values from a response ${valueList} (value1, value2, ..) and need to send it in another requests body. All values share the same key "id".

Right now I'm sending the values one by one but it takes too long since the list can have thousands of values.

.foreach("${valueList}", "value"){
.exec(http("Request1")
  .post("/app/common/Confirm.jspx")
    .formParam("id", "${value}")
)}

or

.exec(http("Request1")
  .post("/app/common/Confirm.jspx")
    .formParam("id", "${value(1)}")
    .formParam("id", "${value(2)}")
    .formParam("id", "${value(n)}")
)

Raw output that is generated by this:

id=value1&id=value2&id=value3&...

Can someone suggest a way to set the whole list of values in the body without accessing and setting each value individually?

.multivaluedFormParam should give you what you want

.exec(http("Request1")
.post("/app/common/Confirm.jspx")
  .multivaluedFormParam("id", "${valueList}")
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM