fetch post resources in parallel with different body

Hi all,
I’m trying to implement a simple load test scenario in my app using resources() to send different POST requests in parallel with different body parts.
I used the following (removed the unnecessary boilerplate stuff):

val httpConf = http
  .baseURL("http://localhost:8088/")
  .header("Content-Type", "application/json")
  .userAgentHeader("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36")

val scn = scenario("my simulation").tryMax(maxRestarts,"scenario-restarts"){
  feed(myFeeder).exec(
    getMultipleAction("${myVar}")
  )
}

setUp(scn.inject(rampUsers(players) over rampTime).protocols(httpConf)).maxDuration(simulationTime)


Sorry, but if think there’s either a problem on your side, or there’s something wrong with your analysis.

I tried to reproduce with the below sample and bodies are properly posted:

val httpConf = http
.baseURL(“http://gatling.io”)
.disableWarmUp

val scn = scenario(“Post”)
.exec(http(“main”).post("/").body(StringBody(“MAIN”))
.check(status.is(403)) // so that main request succeeds and resources are triggered
.asJSON
.resources(
http(“res1”).post("/").body(StringBody(“RES1”)).asJSON,
http(“res2”).post("/").body(StringBody(“RES2”)).asJSON))

setUp(scn.inject(atOnceUsers(1)))
.protocols(httpConf)

Thanks for the prompt response Stéphane.

Actually there was a slight mistake in my previous example (due to copy and paste).
In my code the second version of the getMultipleAction function didn’t have the body part on the main request, but only in the inner requests inside the “resources()”.
That way, the body part gets ignored and not attached to the request.

Instead, doing you way - that is putting the body part both on the main request and on the inner ones - it works fine.
I don’t know if the above is expected behavior but for me it would not be a big deal as a workaround anyway.

Thank you for your contribution.
Antonio.

I removed the body of my main request and body resources where posted just fine (tested with current master/snapshot).
Once again, please provide a full fledged reproducer.

Here a full fledged example:

val httpConf = http
  .baseURL("http://gatling.io")
  .disableWarmUp



val scn = scenario("test simulation")
  .exec(
    getTestAction()
  )


Sorry I miss a bit in my previous exampe:

setUp(scn.inject(rampUsers(2) over 2s).protocols(httpConf)).maxDuration(1m)

Nah. Your sample doesn’t work because it misses this one line from mine:

.check(status.is(403)) // so that main request succeeds and resources are triggered

resources are only fetched if main request doesn’t fail.

I see. I assume there is now way to avoid the main request and trigger the ones in parallel then directly.
I will use .check(status.is(403)) as a workaround as in your previous example.

Thank you for your time.
Antonio.

I assume there is now way to avoid the main request and trigger the ones in parallel then directly.
No, not atm. Maybe in Gatling 3.