Home > OS >  Gatling scala: Check that the status code belongs to a list
Gatling scala: Check that the status code belongs to a list

Time:07-05

For a scenario I want to check that status code of the response belongs to 200-209 or 304 or 404.

I tried the following but apparently it's not supported. And I can't find my use case in the docs.

scenario("Scenario example").exec(httpRequest
    .check(status.in(200 to 209, 304, 404)))

Is there a better solution other than listing the codes manually?

    .check(status.in(200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 304, 404))

CodePudding user response:

status.in((200 to 209)    List(304, 404))

CodePudding user response:

You passed something mixed with Seq and Int.

The method in takes Seq[Int]:

.check(
      status.in((201 to 209) :  303 :  304)
    )
  • Related