Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import io.gatling.http.Predef._
import io.gatling.core.Predef._
import scala.concurrent.forkjoin.ThreadLocalRandom
import io.gatling.core.validation.Success
import bootstrap._
class Gist extends Simulation {
val baseURL = "http://localhost:8080"
val httpConf = http
val data: Array[Map[String, String]] = csv("ids.csv").data // get the underlying array
val feedIds = (session: Session) => {
val random = ThreadLocalRandom.current
val ids = (0 to (random.nextInt(10) + 1)).map(n => data(n)("id").toSet.mkString(","))
println("ids = " + ids)
new Success(session.set("ids", ids))
val scn = scenario("Retrieve IDs")
setUp(scn.inject(ramp(10) over 10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment