Hi Gatling Group
Wanted to ask about how you are meant to pass values in a .json file to a gatling feeder successfully (v 3.0.0)? I’m getting a JSON parse error right now and I suspect it’s because its cutting off the first json element called “data”.
Here is my code:
val partyEventRequestName = "PartyEvent-Request"
val partyEventFeeder = jsonFile("fem/data/partyevents.json").circular
val partyEventScenarioBuilder = scenario("PartyEvent-Scenario").during(InputValues.runDurationSeconds seconds) {
feed(partyEventFeeder)
.exec(
http(partyEventRequestName)
.post(InputValues.partyEventURI)
// .body(StringBody("""{"data":{"type":"partyEvent","attributes":{"gcisPartyId":null,"actionSuccessful":true,"actionErrors":null,"partyAttributes":{"actionType":"Authenticate"}}}}"""))
.body(StringBody(""""${data}""")).asJson
.headers(InputValues.commonHeaders)
.header("X-REQUEST-ID", "GATLING-" + randomUUID().toString)
.check(status.is(202))
)
}
Here is my partyevents.json file (with just one entry in there for now, although I’d like to add more):
[
{
"data": {
"type": "partyEvent",
"attributes": {
"gcisPartyId": null,
"actionSuccessful": true,
"actionErrors": null,
"partyAttributes": {
"actionType": "Authenticate"
}
}
}
}
]
The gatling debug output shows: