Hi
Fairly new to Gatling and a little confused about how to make use of EL and Session variables that are not strings. I've read the docs, but there must be something that I don't understand. Hopefully somebody can point me in the right direction. Basically, how can I get something like this to work?
"""
import java.util.UUID
import io.gatling.core.Predef._
import io.gatling.core.session.Expression
import io.gatling.core.structure.{ChainBuilder, ScenarioBuilder}
import io.gatling.http.Predef._
import io.gatling.http.protocol.HttpProtocolBuilder
import io.gatling.http.request.builder.HttpRequestBuilder
import scala.concurrent.duration._
class MySimulation extends Simulation {
val httpConf: HttpProtocolBuilder = http.baseURL(AppConfig.baseUrl).disableCaching
val feeder: Iterator[Map[String, Any]] = Iterator.continually(Map(
"USER_ID" -> scala.util.Random.alphanumeric.take(11).mkString,
"RESOURCE_IDS" -> Seq.fill(10)(UUID.randomUUID)))
val requestChain: List[ChainBuilder] = List(
exec(getUser("${USER_ID}")),
exec(getResources("${RESOURCE_IDS}")))
val testScenario: ScenarioBuilder = scenario("MySimulation").forever(feed(feeder).exec(requestChain))
setUp(testScenario.inject(atOnceUsers(AppConfig.userCount))).protocols(httpConf).maxDuration(1 minutes)
def getUser(userId: String): HttpRequestBuilder =
http("getUser")
.get(s"/user/$userId")
def getResources(resourceIdsExpression: Expression[List[String]]): HttpRequestBuilder = {
???
}
}
"""