I am new to Scala and Gatling.
I am trying to write framework for Load and performance testing using Gatling API in Scala for REST API endpoints.
I have a query regarding one of the code snippet which is supposed to generate signature(calling another method) and save the value in the session.
.exec(session => {
session.set("sign", SignatureGeneration.getSignature(key, ElFileBody("abc.json").toString()))
})
abc.json -
{"device": "${device}"}
In above code getSignature takes arguments (String, String)
. I want to read the json file and replace ${} value in it with the feeders and send it as String to the method.
While debugging the code I found out, ElFileBody send object as <function1>
and not the json content of it.
Solution -
val bodyExpr = ElFileBody("abc.json")
val bodyStr = bodyExpr(session).get
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.