Hi guys,
I am new to gatling and we just started using it in our company. So far so good, it is amazing , however, now I would like to make more complex scenario where I do certain action (in this case request) to endpoint for multiple users in parallel (our users not gatling users/workers).
So can anyone tell me how can I achieve such behavior? I was thinking of that I need to run the same scenario with different parameters in parallel, but then I saw https://gatling.io/docs/current/http/http_protocol/#http-client-sharing and now I am confused will that work?
`
package sandbox
import tokens.Tokens
import scala.io.Source
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class CalculateBetslip extends Simulation {
val users = new Tokens
val maxUsers = Integer.getInteger(“users”, 1)
val placeBets = http
.baseURL(“host here”)
.inferHtmlResources()
.headers(
Map(
“Accept” → “/”,
“Authorization” → users.tokens(0), // ← I want this to be dynamic for each GATLING user/worker
“ContentType” → “application/json”
)
)
val headers_0 = Map(
“accept-encoding” → “gzip, deflate”,
“cache-control” → “no-cache”,
“content-length” → “291”)
val placeBetsScenario = scenario(“placeBets”)
.exec(http(“request_0”)
.post("/betting/placeBets")
setUp(placeBetsScenario.inject(atOnceUsers(1)).protocols(placeBets)) // Our api holds state, which means that here , when I supply (lets say atOnceUsers(100)) I want to use 100 different tokens but I don’t know how
}
`