Created
September 5, 2014 11:57
-
-
Save anonymous/e1ba8c4f508f25c8255e 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.core.Predef._ | |
import io.gatling.http.Predef._ | |
import scala.concurrent.duration._ | |
class BasicSimulation extends Simulation { | |
val passwords = csv("passwords.csv") | |
def setPassNum = exec(session => | |
session.set("passwordNumber", "3")) | |
val passwordsByNumber: Map[Int, String] = | |
passwords.records.map(record => | |
record("passNum").toInt -> record("passVal")).toMap | |
def findPassword = | |
exec(session => session("passwordNumber") | |
.validate[Int] | |
.map(number => | |
session.set("password", passwordsByNumber(number)))) | |
val httpConf = http | |
.baseURL("http://google.com") // Here is the root for all relative URLs | |
val scn = scenario("Scenario Name") // A scenario is a chain of requests and pauses | |
.exec(http("request_1") | |
.get("/")) | |
.exec(setPassNum) | |
.exec(findPassword) | |
.exec((session: Session) => { | |
println(session.get("counter")) | |
session | |
}) | |
setUp(scn.inject(atOnceUsers(1)).protocols(httpConf)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment