I am building a gatling feeder with 50 values in the sequence like this
var count = 0
val feeder = generateSequence {
val takenCount = (count++).takeIf { it < 50 }
if (takenCount != null) {
mapOf(
"requestParam" to "requestParamValue$count",
)
} else {
null
}
}.iterator()
and define the scenario
val scn =
scenario("Test scenario")
.feed(feeder)
.exec(
http("Post request")
.put("/someUrl")
.header("Content-Type", "application/json")
.body(
StringBody(
"""
{
"requestParam": #{requestParam}
}""".trimIndent()
)
)
)
.pause(1)
now, instead of using atOnceUsers(50)
and making 50 concurrent HTTP requests like here
init {
setUp(
scn.injectOpen(
atOnceUsers(50)
).protocols(httpProtocol)
)
}
I'd like to make whatever number of requests in the feeder (50) sequentially with only 1 user
I believe Gatling does not allow feed
to detect the end of feeder then stop the virtual user gracefully. So you'll have to specify the loop count.
You can launch only 1 user, then use repeat
to loop through the feeder.
scenario("Test scenario")
.repeat(50).on(
feed(feeder)
.exec(
http("Post request")
.put("/someUrl")
.header("Content-Type", "application/json")
.body(
StringBody(
"""
{
"requestParam": #{requestParam}
}""".trimIndent()
)
)
)
.pause(1)
)
)