Search code examples
scalaperformanceloopsgatlingscala-gatling

Overriding object value in loop in scala


im trying to write some generic test scenario builders for gatling and my problem is that I have a list of objects, and I want to iterate over it and do something with every object.

So i do like this

var counter = 0
   val scn = scenario("scenario")
      .repeat(requestsList.requests.size) {
        var tmp = requestLists.requests(counter)
                 ....
counter += 1
}

but when I printing tmp object it always show the first object from list and dosen't get second one. What im missing?


Solution

  • the gatling DSL creates immutable builders that are only executed once - so your looping / array indexing approach won't work

    you'll have to use gatling's feeder constructs