Problem to use feeds

Hi, I was implementing a Scenario in the gatling:

val renderConfig = tsv(“render-config.tsv”).circular
val RenderWithPause_2seg = scenario(“RenderWithPause-2seg”).
feed(renderConfig)
.exec(new RenderQueries(2, {tile_init}, “${num_actions}”, actions).tourOnTheMap)

The content of “render-config.tsv” is:
tile_init num_actions actions
2/1/1 2 PAN_L,ZOOM_I
3/0/0 3 PAN_D,PAN_L,ZOOM_O

I would to pass the values of this file to the class RenderQueries. I try the above possibilites but it did not work.
Can someone help me, please??

This class is as folow:

class RenderQueries(time: Int,
tile_init: String, numActions: String, actions: String) {

println("Tile - ${tile_init} - " + time + " == " +numActions)

val tourOnTheMap =
repeat(numActions) {
exec(
http(“Tile - ${tile_init} - " + time)
.get(”/styles/"+numActions)
)
.pause(time)
}
}

Thanks

You pass {tile_init} to new RenderQueries, this is invalid. You probably mean “tile_init”.
Then, there’s no way your println works as you expect it, because the EL expression won’t be resolved here.

Please have a closer look at the documentation: http://gatling.io/docs/2.0.0/session/expression_el.html

Thanks Stéphane.

I was studying the source code of gatling to understand better. I can not found where the feeds are readed.

Each line is read when a “exec” method is executed?
The “Users” are constructed before the Runner.scala execute or after?

If we can talk more by emaill or other social media, will be very nice.

Since now thanks!
My email is: everton.jiujitsu@gmail.com

You are mixing build-time execution semantics with run-time semantics, something that takes a while to get straight.

Your first parameter is a flat 2, which is the pause time. That will work okay, since it is not dependant on the contents of the session.
Second parameter is supposed to be the value of the session parameter. It doesn’t work that way. Your object is built exactly once, during scenario construction time.
Third parameter and 4th parameter have the same problem.

What you need to do is just pass things around via the session and the feeder, and just assume the correct session variable names in your class.

val tourOnTheMap = repeat( “${numActions}” ) { // no promises that this will work, I am not testing it,
exec(
http( "Tile = ${tile_init} - " + time ) // the time part is not coming from the feeder, so that works
.get( “/styles/${num_actions}” )
)
.pause( time )

}

But I notice that you use num_actions, but not actions.

Hi Everton,

Private mails and such are for customers only :slight_smile:

Cheers,

Stéphane