Created
October 21, 2013 14:14
-
-
Save arikogan/7084579 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
.baseURL(baseURL) | |
.disableFollowRedirect | |
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") | |
exec(feedIds) | |
.exec(http("request_1").get("?ids=${ids}").check(status.is(200))) | |
setUp(scn.inject(ramp(10) over 10)) | |
.protocols(httpConf) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment