Change Gatling protocols during scenario

I want to change the Authorization token during running Gatling scenario because I want to test with different users, this is my HTTP protocol:

val httpProtocol = http
    .baseUrl("https://192.168.165.176:30479")
    .inferHtmlResources()
    .acceptHeader("application/json, text/plain, */*")
    .acceptEncodingHeader("gzip, deflate")
    .acceptLanguageHeader("IR")
    .userAgentHeader("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0")
    .header("Authorization", "Bearer XXXX")

How can I change the protocols during running scenario in setUp(scn.inject(rampUsers(1) during (10 seconds))).protocols(httpProtocol) I want to define more than one httpProtocol and use them in one scenario

Upvotes: 1

Views: 820

Answers (1)

Stéphane LANDELLE
Stéphane LANDELLE

Reputation: 6600

No that's not possible. Protocols can be attached globally on the setUp, or on each scenario. Not on injection steps.

Upvotes: 2

Related Questions