Help with custom feeder

Hi,

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”)

.post("""/login""")

.param(“username”, “user1”)

.param(“password”, “password1”)

.check(status.is(204)))

.feed(feeder)

.exec(http(“Post Request”)

.post("""/api/users""")

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

.check(status.is(201)))

https://github.com/excilys/gatling/wiki/Session#el

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!