Stanko
Stanko

Reputation: 4465

Sequential scenarios each with a different protocol

I have a simulation where I first need an admin user to do certain things before a normal user can perform certain tasks.

val adminConf = http
.baseURL(server)
.headers(sentHeaders)
.basicAuth(admin, password)

val normalUserConf = http
.baseURL(server)
.headers(sentHeaders)
.basicAuth(normalUser, password)

At the moment I'm only able to run one scenario:

setUp(adminScenario
        .inject(atOnceUsers(1))
        .protocols(adminConf))

How can I run one scenario with the adminConf protocol and one scenario with the normalUserConf protocol sequentially?

Upvotes: 0

Views: 92

Answers (1)

Nazarii Bardiuk
Nazarii Bardiuk

Reputation: 4342

Gatling does not have API to run scenarios sequentially.

What you have described looks like setup step. I would recommend to use before hook to perform initial setup. Here is relevant question.

Because inside before we don't have access to gatling we chose to use sttp library that has API somewhat similar to gatling

sttp
  .cookie("login", "me")
  .body("This is a test")
  .post(uri"http://endpoint.com/secret")
  .send()

Upvotes: 1

Related Questions