Gatling version: 3.11.5 (must be up to date)
Gatling flavor: [X ] java kotlin scala javascript typescript
Gatling build tool: maven gradle sbt bundle npm
I read the guidelines and how to ask a question topics.
Hello,
I have an .exec in a scenarioBuilder and the exec has ".resources() with many http requests.
I am trying to capture a value from the response from ONE of the http requests in the “.resources(” block. Example of the resources block is below. All I have seen on the internet suggest a certain way to saveAs and then print but Intellij is telling me the syntax is incorrect when it comes to the exec with session lambda expression:
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/api/auth/whoami")
.get("/quote-api/api/auth/whoami")
.resources(
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/api/quote/getUserDetails/#{rqr_userid}")
.get("/quote-api/api/quote/getUserDetails/#{rqr_userid}"),
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/api/properties/googleAnalyticsKey")
.get("/quote-api/api/properties/googleAnalyticsKey"),
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/api/properties/buildInfo")
.get("/quote-api/api/properties/buildInfo"),
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/v1/user-acknowledgements")
.get("/quote-api/v1/user-acknowledgements"),
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/api/quote/canAccessQuote/347424ae-4089-4231-ad45-b0160657dfc3")
.get("/quote-api/api/quote/canAccessQuote/347424ae-4089-4231-ad45-b0160657dfc3"),
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/api/quote/checkPendingFiling/347424ae-4089-4231-ad45-b0160657dfc3")
.get("/quote-api/api/quote/checkPendingFiling/347424ae-4089-4231-ad45-b0160657dfc3"),
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/api/quote/getCarriersList")
.get("/quote-api/api/quote/getCarriersList"),
http("RqrClickStartNewQuote:GET_http://rqr-dev.zic.pri/quote-api/v1/quote-form/quote-form/347424ae-4089-4231-ad45-b0160657dfc3")
.get("/quote-api/v1/quote-form/quote-form/347424ae-4089-4231-ad45-b0160657dfc3")
.check(bodyString().saveAs("BODY"))
.exec(session => {
val response = session("BODY").as[String];
println(s"Response body: \n$response");
package$
}),
Not sure how to accomplish this and it seems the return value of the “check” does not have a “exec” method. Also, even though I type the work “session” above, after the println, Intellij keeps substituting the word “package$”. Why is this?
Thanks, Timmer