PloniStacker
PloniStacker

Reputation: 666

How do I get a specific value from a feeder using a number?

So assume that I have a feeder with list of values, for example:

[{
  "id": "000000066",
  "id": "000000004",
  "id": "000000002",
   etc...
}]

Now, I'd like to send value number 3 (000000002) to a function that saves something in the session, for example:

exec(session => {session.set("value",valueGenerator(session("feederList(3)").as[String]))})

(feederList is my feeder session variable) Obviously the above doesn't work - Is there any way to do this?

Upvotes: 0

Views: 311

Answers (1)

Stéphane LANDELLE
Stéphane LANDELLE

Reputation: 6623

if you insist in using Gatling built-ins feeders to read data and use them as CSV readers, you can user readRecords to grab the full Array in memory. You can then user the Session API to grab the record you want, in functions or an in exec block.

Upvotes: 1

Related Questions