Hi All,
I am a newbie in Gatling. I’m having problem in handling multiple users with the use of csv feeders.
Here’s the case:
In the first csv file:
- column 1 - 20 emails
- column 2 - 1 password (since server has been bypassed)
In the second csv file:
- column 1 - 20 emails (same as in csv file #1)
- column 2 - 100 isbn (since server has been bypassed)
Here’s the scenario:
- Login
- Search ISBN
- Logout
Every user is entitled with 5 isbn.
What I need to do is perform a load test with my app, injecting 100 users.
So far, here’s what I have done:
//Scenario
val scn = scenario(“GMSLoadTest”).exec(Login.log_in, Logout.logout)
// LOGIN
object Login {
val userCredentials = csv(“user.csv”).random
val log_in = exec(http(“NavigateIntranet”)
.get(uri1 + “/ListApplications.do”))
.feed(userCredentials)
.exec(session => session.set(“email”, session(“email”).as[String]))
.exec(session => session.set(“password”, session(“password”).as[String]))
.exec(http(“Login”)
.post(uri1 + “/login.do”)
.formParam(“email”, “${email}”)
.formParam(“password”, “${password}”))
def lalala(username: String, app_id: String, session_id: String, userid: String) =
exec { session =>
session.set(“username”, “${userName}”)
session.set(“app_id”, “${appId}”)
session.set(“session_id”, “${sessionId}”)
session.set(“userid”, “${userId}”)
// println("username: " + “${userName}”)
// println("app_id: " + “${appId}”)
// println("session_id: " + “${sessionId}”)
// println("userid: " + “${userId}”)
}
.exec(http(“GMS-UAT”)
.get("/nams/login.do?username=" + “${userName}” + “&app_id=” + “${appId}” + “&session_id=” + “${sessionId}” + “&userid=” + “${userId}”))
//.get("/nams/login.do/")
//.queryParam(“username”,"${userName}")
//.queryParam(“app_id”,“164002”)
//.queryParam(“session_id”,“0BB10F24174309F54AF7C676D1532C80.tomcat2”)
//.queryParam(“userid”,“44764”))
}
// SEARCH ISBN
object SearchISBN {
val search_isbn = exec(http(“SearchISBN”)
.post("/nams/nams_search.do"))
.feed(isbnToSearch)
.exec(http(“SearchISBN”)
.post("/nams/nams_search.do")
.queryParam(“searchWord”, “${isbn}”))
}
// LOGOUT
object Logout {
val logout = exec(http(“Logout”)
.get("/nams/logout.do"))
.exec(http(“request_26”)
.get(uri1 + “/ListApplications.do”))
}
setUp(scn.inject(atOnceUsers(100))).protocols(httpProtocol)