Search code examples
gatlingscala-gatling

Gatling script compilation error saying value 'check' is not a member


I have a method in a gatling user-script as below. This script was written in gatling 2.3.

def registerAddress: ChainBuilder = {
    exec(ws("WS Register Address").wsName(id)
      .sendText(prefetchAddress)
      .check(wsAwait.within(30).until(1).regex("success").exists))
      .exec(ping)
}

I am converting this in to gatling 3.0 and when I try to run it I get the following error.

value check is not a member of io.gatling.http.action.ws.WsSendTextFrameBuilder

I searched everywhere but I couldn't find a documentation related to WsSendTextFrameBuilder class to change the method call accordingly.

Does anyone know a documentation related to this class or a way to fix this issue?

Thank you.


Solution

  • After going through the documentation of Gatling 2.3 and 3.0 I found the new calls for the above scenario.

    Apparently the check method is not available anymore in the WsSendTextFrameBuilder class. Instead of that should use the await method.

    So the code would look something similar to below.

    val checkReply = ws.checkTextMessage("request").check(regex("request-complete"))
    def registerAddress: ChainBuilder = {
        exec(ws("WS Register Address").wsName(id)
          .sendText(prefetchAddress)
          .await(30 seconds)(checkReply))
          .exec(ping)
    }