Execute same scenario with multiple multiple specific authorizationHeaders

23 views
Skip to first unread message

Craz1Cadr1ca

unread,
Jan 19, 2018, 4:19:48 AM1/19/18
to Gatling User Group
Hi guys, 

I wrote very simple scenario, 

package placeBet


import scala.concurrent.duration._


import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._


class placeBet extends Simulation {


 val httpProtocol
= http
 
.baseURL("http://localhost:49815")
 
.proxy(Proxy("localhost", 49815).httpsPort(49815))
 
.inferHtmlResources()
 
.acceptHeader("*/*")
 
.authorizationHeader("Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJQbGF5ZXJJZCI6IjQ5MzE0NTQiLCJTZXNzaW9uSWQiOiIzZWNmOGQyMS04NjVhLTQ1OTQtOGQyZS00MDBhNjU4YTAwOWMiLCJTaXRlSWQiOiIxIiwibmJmIjoxNTA3NjQ4Njc0LCJleHAiOjE1MDgyNTM0NzQsImlhdCI6MTUwNzY0ODY3NH0.j3ID6egSwaFcQ-u8Sa8Qu40fNPAJIA7GWFoSBhBV98U")
 
.contentTypeHeader("application/json")


 val headers_1
= Map(
 
"Postman-Token" -> "cdc4e6fc-4198-41c6-bf0d-3b7b51a99d6b",
 
"accept-encoding" -> "gzip, deflate",
 
"cache-control" -> "no-cache",
 
"content-length" -> "242")


 val scn
= scenario("placeBet")
 
.exec(http("request_1")
 
.post("/betting/placeBets")
 
.headers(headers_1))


 setUp
(
   scn
.inject(
 nothingFor
(4 seconds), // 1
 atOnceUsers
(10), // 2
 rampUsers
(10) over(5 seconds), // 3
 constantUsersPerSec
(20) during(15 seconds), // 4
 constantUsersPerSec
(20) during(15 seconds) randomized, // 5
 rampUsersPerSec
(10) to 20 during(10 minutes), // 6
 rampUsersPerSec
(10) to 20 during(10 minutes) randomized, // 7
 splitUsers
(1000) into(rampUsers(10) over(10 seconds)) separatedBy(10 seconds), // 8
 splitUsers
(1000) into(rampUsers(10) over(10 seconds)) separatedBy atOnceUsers(30), // 9
 heavisideUsers
(1000) over(20 seconds) // 10
   
).protocols(httpProtocol)
 
)
}


but now the business from me whats to execute this scenario with multiple different users ( a.k.a different tokens in authorizationHeader), I've searched in the internet and I couldn't find anything helpful.

Do you know how to do this without multiplying the scenario itself?
Reply all
Reply to author
Forward
0 new messages