# Problem with multiple users, csv feeders and sessions

**URL:** <https://community.gatling.io/t/problem-with-multiple-users-csv-feeders-and-sessions/2417>\
**Category:** Gatling (Open-Source)\
**Created:** [July 23, 2015, 7:46am UTC](https://community.gatling.io/t/problem-with-multiple-users-csv-feeders-and-sessions/2417 "2015-07-23T07:46:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian1](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@Julian1](https://community.gatling.io/u/Julian1)\
**Post date:** [July 23, 2015, 7:46am UTC](https://community.gatling.io/t/problem-with-multiple-users-csv-feeders-and-sessions/2417/1 "2015-07-23T07:46:49Z")

</div>

Hi All,

I am a newbie in Gatling. I’m having problem in handling multiple users with the use of csv feeders.

Here’s the case:

In the first csv file:

- column 1 - 20 emails
- column 2 - 1 password (since server has been bypassed)

In the second csv file:

- column 1 - 20 emails (same as in csv file #1)
- column 2 - 100 isbn (since server has been bypassed)

Here’s the scenario:

1. Login
2. Search ISBN
3. Logout

Every user is entitled with 5 isbn.

What I need to do is perform a load test with my app, injecting 100 users.

So far, here’s what I have done:

//Scenario  
val scn = scenario(“GMSLoadTest”).exec(Login.log\_in, Logout.logout)

// LOGIN

object Login {

val userCredentials = csv(“user.csv”).random

val log\_in = exec(http(“NavigateIntranet”)  
.get(uri1 + “/ListApplications.do”))

.feed(userCredentials)  
.exec(session =\> session.set(“email”, session(“email”).as[String]))  
.exec(session =\> session.set(“password”, session(“password”).as[String]))

.exec(http(“Login”)  
.post(uri1 + “/login.do”)  
.formParam(“email”, “${email}”)  
.formParam(“password”, “${password}”))

def lalala(username: String, app\_id: String, session\_id: String, userid: String) =  
exec { session =\>  
session.set(“username”, “${userName}”)  
session.set(“app\_id”, “${appId}”)  
session.set(“session\_id”, “${sessionId}”)  
session.set(“userid”, “${userId}”)

// println("username: " + “${userName}”)  
// println("app\_id: " + “${appId}”)  
// println("session\_id: " + “${sessionId}”)  
// println("userid: " + “${userId}”)  
}

.exec(http(“GMS-UAT”)  
.get("/nams/login.do?username=" + “${userName}” + “&app\_id=” + “${appId}” + “&session\_id=” + “${sessionId}” + “&userid=” + “${userId}”))  
//.get("/nams/login.do/")  
//.queryParam(“username”,"${userName}")  
//.queryParam(“app\_id”,“164002”)  
//.queryParam(“session\_id”,“0BB10F24174309F54AF7C676D1532C80.tomcat2”)  
//.queryParam(“userid”,“44764”))  
}

// SEARCH ISBN  
object SearchISBN {

val search\_isbn = exec(http(“SearchISBN”)  
.post("/nams/nams\_search.do"))  
.feed(isbnToSearch)  
.exec(http(“SearchISBN”)  
.post("/nams/nams\_search.do")  
.queryParam(“searchWord”, “${isbn}”))  
}

// LOGOUT

object Logout {  
val logout = exec(http(“Logout”)  
.get("/nams/logout.do"))  
.exec(http(“request\_26”)  
.get(uri1 + “/ListApplications.do”))  
}

setUp(scn.inject(atOnceUsers(100))).protocols(httpProtocol)

---

<div class="post-metadata">

**Author:** ![jarrowwx](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jarrowwx](https://community.gatling.io/u/jarrowwx)\
**Post date:** [July 24, 2015, 10:24pm UTC](https://community.gatling.io/t/problem-with-multiple-users-csv-feeders-and-sessions/2417/2 "2015-07-24T22:24:41Z")

</div>

Simplify your life. Don’t try to treat your csv files like a relational database. Put the logic in the csv file. One file, 100 lines, emails and passwords replicated 5 times, but only one ISBN per line.

Alternatively, don’t assign an ISBN to an email. Use the first file for username and password, and the second has an ISBN only. Whether or not that will work for you depends on the constraints of the system under test.

---

<div class="post-metadata">

**Author:** ![Julian1](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@Julian1](https://community.gatling.io/u/Julian1)\
**Post date:** [July 27, 2015, 5:20am UTC](https://community.gatling.io/t/problem-with-multiple-users-csv-feeders-and-sessions/2417/3 "2015-07-27T05:20:19Z")

</div>

Hi John,

First of all, thank you very much for responding.

As per your advise, my csv files contain the same. One file, 100 lines, emails and passwords replicated 5 times. The only difference is that the second file has one column for email and another for isbn, which, as you have said, must contain column for isbn only.  
What I need to know is the proper approach on how to make this work. I also want to know if the script that I have made makes sense. Am I using session/csv correctly? Please, could you give me any advise on these?  
Thanks.

---

<div class="post-metadata">

**Author:** ![jarrowwx](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jarrowwx](https://community.gatling.io/u/jarrowwx)\
**Post date:** [July 27, 2015, 6:01pm UTC](https://community.gatling.io/t/problem-with-multiple-users-csv-feeders-and-sessions/2417/4 "2015-07-27T18:01:02Z")

</div>

I’m having a hard time following you.

But to know if you are doing the right thing, you need to understand the constraints of the system. Does it matter if different users search for the same ISBN number? If the answer is yes, then why not? What happens if they do? Similarly, does it matter if the same user has two concurrent queries? Why would the system care?

Step one of any simulation is to decide what the simulation must do, and why. The “why” is important, because it informs your decisions as you writ

---

<div class="post-metadata">

**Author:** ![Julian1](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@Julian1](https://community.gatling.io/u/Julian1)\
**Post date:** [July 30, 2015, 10:50am UTC](https://community.gatling.io/t/problem-with-multiple-users-csv-feeders-and-sessions/2417/5 "2015-07-30T10:50:07Z")

</div>

Thanks, John. Your advise is indeed helpful.

Sorry if you got confused with my explanation. I have posted a more concise explanation here: [https://groups.google.com/forum/#!topic/gatling/jKybEx\_GcA8](https://groups.google.com/forum/#!topic/gatling/jKybEx_GcA8)  
I hope this would make more sense for you. 🙂  
I’m hoping for your immediate response.

Again, thanks.

J.
