Is my .asLongAs condition wrong?

Hi,

Expected output of below code should be 3 calls of like,

  1. https://someurl.net;limit=5;offset=0 (1st call will start from 0 offset everytime - Must)
  2. https://someurl.net;limit=5;offset=5 (2nd call, limit + offsetvalue 0 + 5 = 5)
  3. https://someurl.net;limit=5;offset=10 (3rd call, limit + offsetvalue 5 + 5 = 10)

Here is the code,

import java.util.concurrent.ThreadLocalRandom
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._

class metadataAn extends Simulation {
    val getAssetURL = System.getProperty("getAssetURL", "https://someurl")
    val username = System.getProperty("username", "user")
    val password = System.getProperty("password", "user")

    val limit = Integer.getInteger("limit", 5).toInt
    val counter = 0

    val httpProtocol = http
        .basicAuth(username, password)
        .baseURL(getAssetURL)

    // Step-1 get total count
    val scn = scenario("Get Total assets")
            .exec(http("Number of Assets")
            .get(s"""/api/xyz;limit=1;offset=0""")
            .check(jsonPath("$.totalCount").findAll.saveAs("total"))
            )

    //.asLongAs(session => counter.getAndIncrement().equals("${total}/$limit")) // Throws error mentioned below
    .asLongAs(session => session.get("${counter}").equals("10"))
    {
        exec(http("List of Assets")
            .get(session =>s"""/api/xyz;limit=$limit;offset=${counter}""")
            .check(jsonPath("$.assets[*].id").findAll.saveAs("IdList"))
            )

        .foreach("${IdList}", "idlist") {
            exec(http("Add data")
                .post("""/api/xyz/${idlist}/data""")
                .body(StringBody(session =>s"""{some data....}"""))
                )
            }
        .exec(session => {
                val cnt = session("counter").as[String].toInt
                val increaseCounter = cnt + limit
                session.set("counter", increaseCounter)
                println("********COUNTER************: ====>>> " + increaseCounter)
                session})

    }
    setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}       

OUTPUT:

It compiles but not able to enter into the loop.

---- Get Total assets ----------------------------------------------------------
[##########################################################################]100%
          waiting: 0      / active: 0      / done:1
---- Requests ------------------------------------------------------------------

I’m having the same issue.

equals("${total}/$limit")

This just doesn’t work, please check the documentation: https://gatling.io/docs/current/session/expression_el