Writing Feeder value to a file

76 views
Skip to first unread message

Saritha Reddy

unread,
May 5, 2016, 5:57:30 PM5/5/16
to Gatling User Group
I have a scenario, something like this:

1) Create user using id generated from Feeder, it's a Dynamic Feeder
2) Do some stuff
3) Search other users by Ids. Ids is a type of list

I'm having trouble with implementing the step 3.

Since the Id are dynamically generated, I need a way to capture these Ids somewhere , may be to a file and use them in Step 3. I could n't figure out how to write Ids generated by Feeder into a File.

Tried the following, but could not get this working. ${userId} is not evaluated correctly at the writer.println, the same when used in http get call it's being evaluated properly. Any thoughts?

  val writer = {

    val fos = new java.io.FileOutputStream("data/test-data.txt")

    new java.io.PrintWriter(fos,true)

  }


.....

.exec(session => {

  writer.println("userId :" + "${userId}" )

  session

}

Saritha Reddy

unread,
May 5, 2016, 6:02:54 PM5/5/16
to Gatling User Group

Srinivas D

unread,
Oct 14, 2016, 10:06:07 AM10/14/16
to Gatling User Group
Hi,

I have the exact same problem. Could you please say if you could solve the issue somehow?  highly appreciated...

Srinivas

Barry Perez

unread,
Oct 16, 2016, 9:42:53 AM10/16/16
to Gatling User Group

.exec(session => {

  val userId = session("userId").as[String]

  writer.println("userId :" + userId )

  session

Reply all
Reply to author
Forward
0 new messages