I am trying to run a session where one call depends on the result of another call. I have managed my way through many bugs to do with saving to Session, including a lot of compilation errors on trying to access session when the data didn’t exist yet, and then once data was saved successfully I had to remove special characters that were added (see def req5
in code below).
Anyway, now I have it compiling, but I don’t see my actual request getting built. I don’t see anything to do with it in the logs actually - no reference to Req5
as it appears in the request name, nor any part of the path that I’m querying (both these things appear in logs for all other requests).
Suppose the session variable I’m retrieving for req5 is saved via check(BodyString.saveAs())
in req2, my code looks something like this:
def req5(sessionStr: String): HttpRequestBuilder = http(s"MyScenario - Req5")
.get(s"/path/to/query/${fromJsonString[MyProto](sessionStr.replace("\"", "").replace("\\", "\"")).field}")
setUp(
scenario("MyScenario")
.exec(
exec(req1),
exec(req2),
exec(req3),
exec(req4),
)
.exec { session =>
req5(session("myString").as[String])
session
}
.inject(injectionProfile)
I have also tried the following instead of chaining req5 after all the others:
exec(req2).exec { session => req5(session("myString").as[String]) session }
with exact same results - ‘successful’ test passing with all requests showing success, but no trace of req5
Note: if I change it it to the following, I get an error saying Session
does not contain myString
setUp(
scenario("MyScenario")
.exec(
exec(req1)
exec(req2)
exec(req3)
exec(req4)
exec(req5(session("myString").as[String]))
session
}
.inject(injectionProfile)
Any help is greatly appreciated.