I have the following code
package lts
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class BankingSimulation extends BaseSimulation {
val paginateThroughCustomTransactionsView = scenario("Scenario 04: Paginate through custom transactions view")
.feed(csv("scenario04.csv").circular)
.exec(http("04_paginateThroughCustomTransactionsView")
.get("/api/savings/transactions?viewfilter=${viewEncodedkey}&offset=0&limit=50")
.header("accept", "application/json")
.check(jsonPath("$..encodedKey").saveAs("myEncodedKey"))
)
.asLongAs("${myEncodedKey.exists()}","offsetCounter", exitASAP = false) {
exec(http("04_paginateThroughCustomTransactionsView")
.get("/api/savings/transactions?viewfilter=${viewEncodedkey}&offset=${offsetCounter}&limit=50")
.header("accept", "application/json")
.check(jsonPath("$..encodedKey").saveAs("myEncodedKey"))
)
}
setUp(
paginateThroughCustomTransactionsView.inject(incrementConcurrentUsers(1).times(1).eachLevelLasting(1))
).protocols(httpProtocol)
}
Right now the scenario works but the offsetCounter is incremented by 1 everytime. How can I increment it by 50?
perhaps a nicer way... don't rely on the loop counter and use a feeder instead
var offsetFeeder = (50 to 1000 by 50).toStream.map(i => Map("offsetCounter" -> i)).toIterator
then inside your .asLongAs block, just
.feed(offsetFeeder)
and execute your "04_paginateThroughCustomTransactionsView" call