1

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

1
  • 1
    The value for .header is an Expression[String], so you can use the Gatling EL for that. Sep 16, 2020 at 13:33

1 Answer 1

2

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

1
  • 2
    I think this is a case of asking the wrong question. The high level goal is to have different authorization headers for different users. OP erroneously think this is to be done by having multiple protocols. Sep 16, 2020 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.