Feeder Value

Hi,

I have a csv file that is read by the feed method and I’d like to parse the value that is returned


val locCookieData = csv(“loc-cookies.csv”).circular

def parseId(str: String) = “[0-9]{7}”.r findFirstMatchIn str mkString

val scn = scenario(“SampleRequest”)

.feed(locCookieData)

.exec(http(“location id”)
.get("/start/url/" + parseId("${locCookie}")))

However, when I pass the “${locCookie}” to the parsedId function, the value “${locCookie}” is passed and not the value from the CSV file.

If I do not pass “${locCookie}” as a parameter to the method, the file value is returned.

I wonder how I can pass the “${locCookie}” value to the parseId function?

Many Thanks

Aidy

Hi Aidy,

None of this will work, for the very good reason that you’re trying to mix Scala code and Gatling EL, and passing static values instead of lambdas.

Please have a look at the documentation and then ping if things are still unclear: http://gatling.io/docs/2.0.0-RC5/session/expression_el.html

What would be suggested to someone who still wanted/needed to do this? Is there any type of work around or direction to go in?

What would be suggested to someone who still wanted/needed to do this? Is there any type of work around or direction to go in?

You have requestName as Expression[String] which is a type alias of Session => Validation[T].