Search code examples
gatlingscala-gatling

How to check if variable exists in a Gatling session?


In this question, an ObjectA creates a session variable, used in ObjectB

ObjectB will fail to execute if ObjectA fails to set the "GroupName" variable.

How to check in ObjectB context that session variable "GroupName" exists?


Solution

  • The gatling EL has support for checking if a variable exists in the session. so you can do something like this...

    exec(ObjectA)
    .doIf("${GroupName.exists()}") {
        exec(ObjectB)
    }