Get usernames from csv feeder and transform them into a map

Hello, I have a large csv file with users, which is loaded like this:

val userFeeder = tsv("users.csv").circular

and used like this:

val scenario: ScenarioBuilder = scenario("Scenario)
    .feed(userFeeder)
    .exec(connect)
    .....

Is there a way to get only the specific usernames which are loaded from the csv file (depending on the number of users specified) and put them into a map. I do not want to put all usernames from the csv file, but have only the ones which are going to be used by the simulation. I need to perform some additional verifications on the users and then feed the scenario with the map of users, which have been verified. Thanks!

Hi,

Wouldn’t it be better to prepare a clean file upfront instead?

Hi,
Thank you for your response. In general yes, it will be easier, but I need to load test a specific game and not all users are eligible to play it and we have a very large file of users, so it is pretty much impossible to create a new file only with the eligible players. Currently this is handled in the simulation code, but I am exploring other options as well, because we do not want to have these kind of errors in the final report.

So how you know what player is “eligible”?
In test data you should have players that “can’t play” and check at begining if this player can play if not end this gatling user by using:
https://gatling.io/docs/gatling/reference/current/core/scenario/#exithere
or
https://gatling.io/docs/gatling/reference/current/core/scenario/#exitblockonfail
or
https://gatling.io/docs/gatling/reference/current/core/scenario/#exithereif
or
https://gatling.io/docs/gatling/reference/current/core/scenario/#exithereiffailed

Hi GeMi,
This is exactly what I implemented in the end, if the player is not eligible to play, I use “exitHereIfFailed”.

1 Like