Feeder variable not getting stored as session variable

39 views
Skip to first unread message

Maithrie Vaidyanathan

unread,
Jan 25, 2022, 5:07:21 PM1/25/22
to Gatling User Group
Hi All,

 I am pretty sure I am wrong somewhere but not able to figure out (after watsing 2 days on this).

val scn = scenario("RecordedSimulation")
.feed(patientfeeder) //has ids
.exec(session => {
val pid = session("ids").as[String]
session.set("patientid",pid)   // also tried session.set("patientid",session ("ids").as[String])
print("value is ${patientid}")   // Won't print patientid value
println(session ("ids").as[String])  //print the  patientid  value
session}).pause(4)

I am not sure why it wouldn't print, when I give as ${patientid} . I am also trying to use it like ${patientid} in a following request and it won't resolve there as well.

Any feedback would really help ! 

Regards,
Maithrie

Stéphane LANDELLE

unread,
Jan 25, 2022, 6:23:41 PM1/25/22
to gat...@googlegroups.com
Please properly read the Session API documentation, in particular the warning :)
--

Stéphane Landelle

Chief Technical Officer

   

slan...@gatling.io
gatling.io
   
facebook twitter linkedin 


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/e45e0756-4f77-469b-8c23-c136b1303e37n%40googlegroups.com.

Vinod Gupta

unread,
Feb 11, 2022, 3:26:01 PM2/11/22
to Gatling User Group
looks like you have to exe session set first before to print in another exe method . i tested it and it is working ( use below code ) 
.exec( session => session.set("patientid",session("ids").as[String])) // name is already available session variable either extract paramter  or csv  parameter 


.exec(session => {
val pid = session("ids").as[String]
println("patientid value is ="+ session("patientid").as[String]) // it print patientid value

println("pid value is ="+pid)// it print pid value 

session})

Reply all
Reply to author
Forward
0 new messages