Search code examples
scalaload-testinggatlingjsonpath

Gatling is freezing when I use jsonPath


I have Gatling version 3.0.0-RC4.

I have the following Gatling code

object Signup {

    val feeder = csv("phones.csv").circular

    var signup = tryMax(2) {
        exec(
            http("Get details")
                .get("/v2/dummy/2")
                .check(status.is(200))
            )
        .feed(feeder)
        .exec(
            http("Signup")
                .post("/v2/user/customer")
                .header(HttpHeaderNames.ContentType, HttpHeaderValues.ApplicationJson)
                .header(HttpHeaderNames.Accept, HttpHeaderValues.ApplicationJson)
                .header("Set-Cookie", "id=2")
                .body(StringBody("""{
                    "email": "[email protected]",
                    "phone_number": "${phoneNumber}",
                    "first_name": "Rishi",
                    "last_name": "Mukherjee",
                    "pin": "1234",
                }""")).asJson
                .check(
            jsonPath("$.otp_data.otp_uuid").saveAs("lastResponse")))
    }.exitHereIfFailed
}

In the line, jsonPath("$.otp_data.otp_uuid").saveAs("OTPUUID"), if I replace that with status.is(200), the code runs just fine. But, with this line, on running the program, it freezes and keeps showing the following

================================================================================
2018-10-12 17:36:11                                           5s elapsed
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=1      KO=0     )
> Get details                                     (OK=1      KO=0     )

---- Signup -------------------------------------------------------------
[--------------------------------------------------------------------------]  0%
    waiting: 0      / active: 1      / done: 0
================================================================================

Problem is, I do not get any error or anything that will be helpful to debug. In fact this also happens when I run the included example AdvancedSimulationStep03.scala. What can be the issue or is there anything I may be missing?


Solution

  • So, I had JDK 11. The docs say I should have had JDK 8. Switched to JDK 8 and it got fixed.

    Hopefully helps anyone else if they get stuck.