Hi Falvio,
How to pass the unique userid for my script.
For example, I run for 10 users for 1 hour.i have 10 user id in my csv file. if the first user takes first user id (2nd iteration also take 1 userid ), 2nd user takes 2 userid …10 users takes 10 userid . Please help on this how to set this
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import com.redis._
import io.gatling.redis.feeder.RedisFeeder
class RecordedSimulation extends Simulation {
val redisPool = new RedisClientPool(“localhost”, 6379)
val feeder = RedisFeeder(redisPool, “userid”)
val httpProtocol = http
.baseURL(“http://xxxxxxxxxxxxxxxxxxxx”)
.inferHtmlResources(BlackList("""..js""", “”"..css""", “”"..gif""", “”"..jpeg""", “”"..jpg""", “”"..ico""", “”"..woff""", “”"..(t|o)tf""", “”"..png"""), WhiteList())
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,/*;q=0.8")
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0”)
val headers_0 = Map(“Upgrade-Insecure-Requests” → “1”,
“Accept” → “/”,
“Pragma” → “no-cache”,
“X-Content-Type-Options” → “nosniff”,
“X-Frame-Options” → “DENY”,
“Upgrade-Insecure-Requests” → “1”,
“Content-Type” → “application/x-www-form-urlencoded”,
“Accept-Encoding” → “gzip,deflate”,
“Accept-Language” → “en-US,en;q=0.9”,
“X-XSS-Protection” → “1”)
val headers_1 = Map(
“Accept” → “/”,
“Pragma” → “no-cache”,
“X-Content-Type-Options” → “nosniff”,
“X-Frame-Options” → “DENY”,
“Upgrade-Insecure-Requests” → “1”,
“Content-Type” → “application/x-www-form-urlencoded”,
“Accept-Encoding” → “gzip,deflate”,
“Accept-Language” → “en-US,en;q=0.9”,
“X-XSS-Protection” → “1”)
val uri1 = “http://detectportal.firefox.com/success.txt”
val uri2 = “http://xxxxxxx:xxxx/SampleApplication”
val userCredentials = csv(“User.csv”).queue //.circular //.random //.record(
val scn = scenario(“RecordedSimulation”)
// AppLaunch
.exec(http(“AppLaunch”)
.get("/SampleApplication/login")
.headers(headers_0)
.check(
.resources(http(“AppLaunch”)
.get(uri2 + “”)
.headers(headers_1)))
.pause(16)
.
// Login
.feed(userCredentials)
.exec(http(“Login”)
.post("/SampleApplication/login")
.headers(headers_0)
.formParam(“ssoId”, “${userid}”)
.formParam(“password”,"${password}")
.formParam("_csrf", “${personId}”))
.pause(48)