Gatling - How to use feeder in a post body which is using raw XML file

I need to use a raw xml file as body in one of my gatling script. in this how we can try feeder.

Tried including variable name in raw file. including feeder in scala code. this didn’t worked.

this is the code in scala

val feeder = csv("data.csv")

val scn = scenario("RecordedSimulation")
        .during(10 seconds)

How we can do parametrization in rawfilebody implimentation

You have to specify the content type along with RawFileBody.

e.g. RawFileBodyPart(“file”, RecordedSimulation_0000_request.txt.xls").contentType(“application/”).fileName(“RecordedSimulation_0000_request.txt.xls”))

Instead, I would suggest to build string variable and send as request body.

e.g. : .body(StringBody("""{ “myContent”: “${myDynamicValue}” }""")).asJSON

Create a string out of rawfile which is having xml body

Hi Madhan,

i my case its a huge XML, i dont think its easy to put as you mentioned. How i can submit a 50+ lined xml ? can you give me a example.
also if i use “RawFileBodyPart” can i include the variable in the file and get used while execution?

please share your valuable suggestions on this.

Karthik MA

Hi Karthik,

Try using .body(ElFileBody(“RecordedSimulation_0000_request.txt”)

This worked, thanks Vikram