Replacement elfilebody with stringbody - template format

HI team
good morning!!

i am using CSV file feeder which will have the following values


{"accountIds": ["#{accountid}"], "refreshCache": true}

and then passing session variable => payload into stringBody

StringBody(" #{payload}")

i know that it will pass only the payload resides in csv like the below format

body:StringChunksRequestBody{contentType=‘null’, charset=UTF-8, content={“accountIds”: [“#{accountid}”]}

session variable does not replace - #{accountid}

i am looking to find the solution - how to tell the elcompiler to replace it - #{accountid} with stringbody

Note: we know that elfilebody works very well, but we want go with stringbody

tried the below code as mentioned in the document

  object Templates {
    val template: Expression[String] = session =>  session("payload").as[String]

.body(StringBody( Templates.template))

but still getting the same value

body:StringRequestBody{contentType=‘null’, charset=UTF-8, content={“accountIds”: [“#{accountid}”]}

session variables accountid not replaced

This won’t work out of the box.
Gatling only parses Strings parameters into functions at some specific places so it only happens once when the Simulation is instantiated and doesn’t harm performance during the load test.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.