I want to use a userId from the Session API inside my test. I could find this comment on the userId: "The userId is a simple sequence and is unique across users." It will work perfectly for me if it's a simple sequence since I want to use it as an index to get items from a collection. So let's say I have a simple scenario where I inject 5 users:
setUp(myScenario.inject(rampUsers(5) during (10.seconds)).protocols(httpProtocol))
How is the userId going to be assigned to those 5 users? Will each user have id starting from 1 in the following manner:
user 1 - userId = 1,
user 2 - userId = 2,
user 3 - userId = 3,
user 4 - userId = 4,
user 5 - userId = 5
You can fetch it from Session. But pay attention - you can't extract it as Gatling EL (nevertheless you can set into Session)
.exec { session =>
println("userId - " + session.userId)
session
}