My question as followed:
I created 10 users to logon one system, but system check duplicate user, if one user logon system, next logon for the same user will be automatically log out.
I will test compound scenarios using 10 users.
I separate 10 users from one file to 4 files.
user and password in csv file.
2 users in 1.csv
3 users in 2.csv
2 users in 3.csv
3 users in 4.csv
when running the following script, error pops up.
- how to handle multiple files in login function?
- If above handle is incorrect, do you have other good advice?
Class CompoundPage extends Simulation {
val headers_0 = Map(
“”“Accept”"" → “”“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8"”",
“”“Cache-Control”"" → “”“max-age=0"”")
val headers_1 = Map(
“”“Accept”"" → “”“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8"”",
“”“Cache-Control”"" → “”“max-age=0"”",
“”“Content-Type”"" → “”“application/x-www-form-urlencoded”"",
“”“Origin”"" → “”“https://portal-qa1.everbridge.net”"")
val headers_2 = Map(
“”“Accept”"" → “”“text/css,/;q=0.1"”",
“”“Cache-Control”"" → “”“max-age=0"”")
val headers_79 = Map(""“Accept”"" → “”“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8"”")
val contactuserinQA = csv(“1.csv”).circular
val notificationuserinQA = csv(“2.csv”).circular
val universeuserinQA = csv(“3”).circular
val dashboarduserinQA = csv(“4.csv”).circular
var logintype=""
def userInQAorStage(logintype: String) : io.gatling.core.feeder.FeederBuilder[_] = {
if(scenParse.baseurl.contains(“portal-qa1.everbridge.net”)) {
if (logintype.contains(“contact”)){
contactuserinQA
}
else if (logintype.contains(“notification”)){
notificationuserinQA
}
else if (logintype.contains(“universe”)){
universeuserinQA
}
else if (logintype.contains(“dashboard”)){
dashboarduserinQA
}
}
else userInStage
}
object object Login{
def login(logintype:String) = {
exec(http(“request_0”)
.get("""/login""")
.headers(headers_0))
.pause(2)
.feed(userInQAorStage(logintype))
.exec(http(“request_1”)
.post("""/check""")
.headers(headers_1)
.formParam(""“nc4Sourse”"", “”"""")
.formParam(""“nc4"”", “”"""")
.formParam(""“username”"", “${user}”)
.formParam(""“password”"", “${password}”)
.formParam(""“input1"”", “”“English (United States)”"")
.resources(http(“request_2”)
.get(uri1 + “”"/statics/stylesheets/jscss/ajax.css?version=V3.1.1-2014-08-28%2002:18:43""")
.headers(headers_2)
.check(status.is(200))
}
object Logout {
val logout = group(“Logout”){
exec(http(“request_204”)
.get("""/logout""")
.headers(headers_79)
.check(status.is(200)))
}
}
val logincontact = scenario(“ContacLogin”).repeat(5){
exec(Login.login(“contact”), Logout.logout)
}
setUp(scn.inject(atOnceUsers(2))).protocols(httpProtocol)
}