.post("""/api/sync/137/13183""")
.headers(headers_1)
.fileBody(“request_4”, Map(“timevalue” → “1374062413”))
// .body(RawFileBody(“request_4.txt”)) // this is what has been recorded
I get syntax error - it does not like fileBody - that is expected. Having read the Gatling 2 update page I figured out there were changes in the API, I fiddled a little bit but no luck.
It would be great if you could provide me and community with an example of solving this task in gatling 2:
using templates
using objects (as mentioned on the update page) - example at the bottom of this section does not provide enough information to get me started.
val scn = scenario(“Create Leg”)
//…
.exec(http(“request_4”)
.post("""/api/sync/137/13183""")
.headers(headers_1)
.body(ELFileBody(“request_4.txt”)) // assume that the Session contains a “timevalue” attribute (from feeder, check.saveAs, or else)
Programmatically
You have to be familiar with for comprehension and string interpolation in Scala.
I see you have dropped SSP support so EL is the way to go for me - I want to make it work first than experiment with the string interpolation option later.
The simulation runs fine but cannot find timevalue
“01:19:55.121 [ERROR] i.g.h.a.HttpRequestAction - No attribute named ‘timevalue’ is defined”
I calculate timevalue programatically and need to set this as an attribute to a session I guess.
However this does not work:
val scn = scenario(“Create Leg”)
//…
.exec(session =>
session.set(“timevalue”, “1374062413”))
.exec(http(“request_4”)
.post("""/api/sync/137/13183""")
.headers(headers_1)
.body(ELFileBody(“request_4.txt”)) // assume that the Session contains a “timevalue” attribute (from feeder, check.saveAs, or else)