Hi
i am using the below code for testing POST request to my API. I user feeder file as JSON for the same
class vertexapistep02 extends Simulation {
object getMultiLine {
val feederJson = jsonFile(“test.json”)
val headers_10 = Map(“Content-Type” → “”“application/json”"")
val multi = exec(http(“PostMultiline”)
.post("/tax_rates/v1/quotations")
.body(ElFileBody(feederJson)).asJSON
)
}
val httpConf = http
.baseURL(“https://test.core.machine”)
.acceptHeader(“application/json, /”)
.acceptCharsetHeader(“UTF-8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)
//Setting up scenarios
val users = scenario(“MobilePOS”).exec(getMultiLine.multi)
//Simluations
setUp(
users.inject(rampUsers(10) over (10 seconds))
).protocols(httpConf)
}
I get the below error at the highlighted portion in the code:
type mismatch;
found : io.gatling.core.feeder.RecordSeqFeederBuilder[Any]
required: io.gatling.core.session.Expression[String]
(which expands to) io.gatling.core.session.Session => io.gatling.commons.validation.Validation[String]
12:21:38.198 [ERROR] i.g.c.ZincCompiler$ - .body(ElFileBody(feederJson)).asJSON
My questions are :
- Is it not possible to use RawFileBody or ELFileBody method when using json feeder?
Since i have a long JSON file, i would not prefer to use StringBody method ?
Any help appreciated.
Thanks,
Sunil