How to loop a csv file

Hi,
I have created a csv files which has 10 000 different user's requests
(10000 lines ).
I want gatling to run all these requests with 10 conncurrent users:

  val scn = scenario("Scenario name")
      .feed(csv("collectorcallurl.csv"))
      .loop(
     chain
    .exec(
      http("request_collectorevent")
      .get("/${collectorcallurl}")
      .check(status.is(200)))
      .pause(0, 10, MILLISECONDS)
        ).
        during(1200, SECONDS)

List(scn.configure.users(10).ramp(10).protocolConfig(httpConf))

My issue is that gatling loop on the 10 first line of my csv file.
What's the way to do that ?

https://github.com/excilys/gatling/wiki/Feeders#wiki-circular

Cheers,

Stephane

2012/5/10 Paul Langeard <agpaul5@gmail.com>

Hi!

The call to feed should be made in the loop just before the exec instruction.

This way, a record of the feeder will be popped for each loop.

Cheers,
BluePyth

Sorry, didn’t read thoroughly.

Your problem is that you didn’t call feed at the right place. Calling “feed” pops an entry from the feeder and inject it into the user’s Session.
So in your case, you have to put it inside the loop:

val scn = scenario(“Scenario name”)
.loop(
chain
.feed(csv(“collectorcallurl.csv”))
.exec(http(“request_collectorevent”)
.get("/${collectorcallurl}")
.check(status.is(200)))
.pause(0, 10, MILLISECONDS)
).during(1200, SECONDS)

2012/5/10 Stéphane Landelle <slandelle@excilys.com>

You were faster, buddy! Your win :wink:

2012/5/10 Romain Sertelon <bluepyth@gmail.com>

Thnks Guys,
once again I am surpise by your reactivity!

The below loop code looks to be broken in gatling 2.0.0-M3, Not able to get the example for the Loop. Please post some example if you have for the 2.0.0-M3 release of gatling.

Thanks in advance.

Regards,
Rohan S Raju.

Please read the documentation: https://github.com/excilys/gatling/wiki/Structure-Elements#wiki-during

hi Stephane,

i want to pass .param(b(0),b(1)) values iteratively

val httpProtocol = http
.baseURL(“url”)

.disableFollowRedirect

.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)
.connection(“keep-alive”)

val header = Map(“Content-Type” → “application/x-www-form-urlencoded”)

var i=0
var j=0
val prop = new Properties()
val writer = {
val fos = new java.io.FileOutputStream(“D:/test-data.properties”)
new java.io.PrintWriter(fos,true)
}
val writer1 = {
val fos = new java.io.FileOutputStream(“D:/test-data.csv”)
new java.io.PrintWriter(fos,true)
}
writer1.println(“key,value”)

try {

val file1 = new FileInputStream(“D:\Config.properties”)
prop.load(file1);
}
catch {
case ex: IOException => Logger.getLogger(classOf[RecordedSimulation123].getName).log(Level.SEVERE, null, ex)
}

val list = prop.propertyNames()

try {
while (list.hasMoreElements()) {

val key = list.nextElement().asInstanceOf[String]
val s=prop.get(key).toString()
val a:Array[String]=s.split("&")
writer.println(a(0)+"\t\t"+a(1)+"\n\n\n")
j=a.length

while( i != a.length)
{

val b:Array[String]=a(i).split("\^")

writer1.println(b(0)+","+b(1))

i+=1
}

val productIems = csv(“D:/test-data.csv”).queue
val scn = scenario(“scenario param”)

.exec(http(“GET web service”)
.headers(header)
.post(key)
.repeat(b.length){
.param(b(0), b(1))
}
)

setUp(scn.inject(atOnce(1 user))).protocols(httpProtocol)

}
}

catch {
case e: Exception =>e.printStackTrace()
} finally {

}

}our suggetions are most useful to me
thanks in advance

y