Search code examples
gatlingscala-gatling

How do you use Gatling's checkIf method?


Documented here, Gatling's checkIf method is intended for conditional checking. It's not available on ScenarioBuilder's fluent API but I can see it in the CheckSupport class. I have scoured the internet and cannot find a single example.

I'm using Gatling 2.3.1.


Solution

  • I found an example in their unit tests as follows:

    http("untypedCheckIf").get("/")
          .check(
            checkIf("${bool}") {
              jsonPath("$..foo")
            }
          )