Multiple users with feeder

Hello Gatling Users,

Some of the earlier threads did not help me clear my understanding.

Version: Gatling 2.2.0

I want MyScenario to run for 2 users as specified in users.csv. But I see session maintained between Login, BrowseRole and SearchAll is one and same for both the users.

//Scenario
val scn = scenario(“MyScenario”).repeat(2){
feed(feeder).exec(Login.login, BrowseRole.browseRole, SearchAll.search)
}

//Setup
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

//Feeder
val feeder = separatedValues(“users.csv”, ‘;’).queue

//Users.csv =========
john1@myorg.com;pass1234;
john2@myorg.com;pass1234;

This works great for 1 user, but when I repeat(2) for 2 users, first user completes MyScenario with success. The second user fails at authentication. I noticed, second users carries same cookies and the header as of first. So somewhere I did not understand the usage of setting up multiple users. Please help me understand.

I am newbie with Gatling.

Thanks,
Jay

Hi Jay,

If I’m not wrong, instances are created with Singleton pattern.

So take this into account if you are setting user values in class/object variables.

In theory, when feeding, each time is run, a different session per user is used.

Cheers