replace feeder values in a variable

82 views
Skip to first unread message

Surendra Marthala

unread,
Jan 2, 2022, 4:08:53 PM1/2/22
to Gatling User Group
Hi,
I have  request body in a variable which has feeder variables.  Is it possible to replace those variables with feeders ?

I need to replace $var1 with test1 from feeder.
For other logic which do some changes to the file before I actual use it as payload, so i can not call directly file with ElFileBody. 

is it possible ?


test.xml
========
<?xml version="1.0" encoding="UTF-8"?>
<note>
<heading>$var1</heading>
</note>

users.csv
========
var1,var2
test1,test1
test2,test2

val feeder = csv("users.csv").random

exec {
session =>
var bodystr = getFile("test.xml")
session.set("bodystr", bodystr)
}
...
http
.body(StringBody("#{bodystr}")

Stéphane LANDELLE

unread,
Jan 2, 2022, 4:22:50 PM1/2/22
to gat...@googlegroups.com
No, it's not possible. Gatling Expression Language doesn't work recursively.
I recommend you directly:
  • either craft your whole body in a function with the help of the Session API
  • or abide to Gatling's logic and built-ins


--

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/f8fdbad3-9f86-49c5-84c0-7508834406c7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages