2
votes

My tests run fine but now I need multiple sessions running at once. I've tried getting the cookie value using headerRegex("Set-Cookie", "HOME_SESSID=(.*)").saveAs("homeSessid") but when I print this out its returning a value of com.excilys.ebi.gatling.http.check.HttpMultipleCheckBuilder@6075598

I have no idea where this is coming from. My question is: what is going on?

Thanks.

edit: forgot to mention that the value its returning is not a session id and no matter what I use for the cookie name I get the same value.

edit (solution):

1) In the first .exec: .check( headerRegex("Set-Cookie", """HOME_SESSID=(.*dll/(\d+))""").saveAs("homeSessid") )

2) Then to retrieve homeSessid in later http requests I did, for example: .post( session=>{session}.getAttribute("homeSessid").toString + "/some/relative/url" )

2

2 Answers

3
votes

1) In the first .exec:

.check( headerRegex("Set-Cookie", """HOME_SESSID=(.*dll/(\d+))""").saveAs("homeSessid") )

2) Then to retrieve homeSessid in later http requests I did, for example:
.post( session=>{session}.getAttribute("homeSessid").toString + "/some/relative/url" )

2
votes

Please properly read the Check documentation. Checks save data into the Session, so that's where you have to read. Here, you're just trying to print the extractor.

For example, after performing your check, you could add a exec(function), like:

.exec(session => {
  println(session("homeSessid").as[String]) // Gatling 2 API
  session
})