Switching between two ssv files

Hi,
First, to explain what I need - " I have to feed values into a post parameter randomly from two different files. To be exact, in 70% cases I need values from one file and in the rest from the other "

What I am trying is this -

val chain_1 = feed(ssv(“first.ssv”).random)
.exec(http(“SimTest1”)
.post(host)
.param(“id”, id)
.param(“payload”, “/${payload}”)
.headers(header)
.check(status.is(200)))

val chain_2 = feed(ssv(“second.ssv”).random)
.exec(http(“SimTest2”)
.post(host)
.param(“id”, id)
.param(“payload”, “/${payload}”)
.headers(header)
.check(status.is(200)))

val scn = scenario(“Scene1”)
.randomSwitch(70 → chain_1, 30 → chain_2)
setUp(scn2.inject(atOnce(100))

But,there are two prolems that I am facing -

  1. The value from ssv file is not read, may be the syntax has a problem.
  2. Is there a need to apply loops here?

I am using Gatling 2.0.0-M3a and my ssv file format is-

payload
abc
def
ghi

It should be working.
The typical error here is to have a typo in the file header name, such as a trailing whitespace. Did you check this?

No, there is no typo in the file header. I’ll check a few other things and tell you the exact problem.
Thanks

I think the value is not read properly from the ssv file. Is there any way in which I can view or print the value before or after sending so that I know what value is being fed into the parameter.

I checked the logs on the server and it is not even receiving any post from the simulation. There must be some error in the scenario description or the format is not OK. Does someone know how to resolve the problem?

Could you print the Session content before sending, like:

exec(session => {
println(session)
session
})

Thanks for this advice Stephane. It would be very helpful in future.

And my simulation is now running perfectly. I got the error. I was mistakingly writing “/${payload}” whereas I required “${payload}”.

Cheers to Gatling !!

Great!
Have fun!