Help with custom feeder


New to Gatling here but loving it so far.

I am having trouble extracting the value of my custom feeder, can someone take a look at the following and let me know what I’m not doing right? In the example below, the String “${file}” keeps getting passed to getJsonRequestBody instead of a value from the feeder. Thanks in advance!

val feeder = FileUtils.iterateFiles(new File(“src/test/resources/data”), null, true).map(file => Map(“file” → file))

val postSomething = exec(http(“Login”)


.param(“username”, “user1”)

.param(“password”, “password1”)



.exec(http(“Post Request”)


.body(StringBody(session => getJsonRequestBody("${file}"))).asJSON


Your “${file}” expression won’t work here. Get the “file” attribute value with the Session API.

Ah, thanks! Works now.

One more thing, how do I create a circular feeder out of this custom feeder?

Gatling circular built-in is available as soon as you have a IndexedSeq[Map[String, T]] or a Array[Map[String, T]].
Otherwise, you’re on your own. You can maybe check the RoundRobin class.

Got it, thanks so much for the quick response!