feeders

1 - this line is to copy the record as session.
exec(session => session(“record”).validate[Map[String, String]].map(record => session.setAll(record.toSeq)))

2 - The record is stored as a Map.

3 - if I want to execute this code, then I need to return a string for ${language} and ${committee} and not a Map.

.exec(
http(“Request Committee”)
.get("${language}/${committee}/home.html")
.check(status.is(200))
)
}

I should have misunderstood something. ;o))

H.

In the log console, the url appears like that :

htt[p://www…/…/Map(languagecode](http://www…/…/Map(languagecode) → ro)/Map(committeecode → afet)/home.html

but it should appear like that

htt/home.html)p://www…/…//home.html

Regards

H.

Could you share a gist of your simulation so I can fix it, please?

Hello Stéphane,

Here is my code. It works now but I don’t like these two parts :

1- language => session.set(“languagecode”, language.mkString("").replace(“languagecode → “, “”))
2- committee => session.set(“committeecode”, committee.mkString(””).replace("committeecode → ", “”))

I think it is not the good way to do.

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.http.Headers._
import bootstrap._
import org.joda.convert.ToString

object CommitteesScenario2 {

val languages = csv(“languages.txt”).data.toSeq
val committees = csv(“committees.txt”).data.toSeq

val scn = scenario(“Get Europarl CO - Scenario with sequences : languages & committees”)
/* loop on languages sequence */
.foreach(languages, “language”){
exec(session =>
// session(“language”).validate[Map[String, String]].map(language => session.setAll(language.toSeq))

session(“language”).validate[Map[String, String]].map(
language => session.set(“languagecode”, language.mkString("").replace("languagecode → ", “”))
)

)
/* loop on committees sequence */
.foreach(committees, “committee”){
exec(session =>
// session(“committee”).validate[Map[String, String]].map(committee => session.setAll(committee.toSeq))
session(“committee”).validate[Map[String, String]].map(
committee => session.set(“committeecode”, committee.mkString("").replace(“committeecode → “, “”))
)
)
.exec(
http(“Request Committee”)
.get(”${languagecode}”+"/"+"${committeecode}"+"/home.html")
.check(status.is(200))

)
.pause(5)
}
}
}

That would be:

val scn = scenario(“Get Europarl CO - Scenario with sequences : languages & committees”)
// loop on languages sequence
.foreach(languages, “language”) {
exec(session =>
// expose languagecode as a root level attribute
session(“language”).validate[Map[String, String]].map(language => session.set(“languagecode”, language(“languagecode”))))
// loop on committees sequence
.foreach(committees, “committee”) {
exec(session =>
// expose committeecode as a root level attribute
session(“committee”).validate[Map[String, String]].map(
committee => session.set(“committeecode”, committee(“committeecode”))))
.exec(
http(“Request Committee”)
.get("${languagecode}/${committeecode}/home.html")
.check(status.is(200)))
.pause(5)
}
}

Stéphane,

Your solution is much more elegant. ;o))). I know how to manage a record and it will be very useful for the future scenario.
I will test it and let you know.

Thanks a lot for your time and your quick replies.

H.

You’re welcome, my friend!

Hello Stephane,

I made my test and it is OK. ;o)))
I was looking informations about gatling.conf. I took a look at this page https://github.com/excilys/gatling/wiki/Configuration but the links do not work.
I have a problem of timeout and I wanted to change this value idleConnectionInPoolTimeoutInMs which is set at 60 by default.

Thanks again
Hassen

Links fixed, thanks!