Somehow I get 400 status code .
In most example I have seen ,data is passed in query or formParam of the request. Is there a way to actually pass csv test data to json payload file from the feeder?
{
“Id”: “#{categoryId}”,
“catalogType”: “double”
}
I made mistake in the json here in the post but nonetheless my json payload used for the request was valid. I assumed probably data from csv was not populated to the json keys. Because when I use static data for categoryId request is successful.
Does Gatling allow to pass paramters(test data ) from csv feeder to json referenced ELFileBody()? Because I need to pass test data record from feeder to request json placeholder variable #{categoryId} and this does not work.
So this is exactly your issue. You’re using the modern Gatling Expression Language syntax with an obsolete Gatling version (3.7.6). Please upgrade. The latest version as of now is 3.9.6.
Still encountered problem(400 status - malformed request) where csv data is to not passed to the parameters defined in request payload even after updating to gatling version 3.9.6. Below is snippet code of code . Don’t really know what is wrong.
Anyways I tried using theJsonFile feeder instead of csv feeder and it is able to pass test data to request payload file.
However Gatling crashes when virtual users does to match feeder records even though I am using the circular strategy .
rampUsersPerSec(1).to(5).during(10) against 4 records in json feeder Error using circular strategy var feeder = jsonFile(“data/posts.json”).circular()
2023-12-02 14:44:03 ERROR main app.Gatling$ Run crashed
java.lang.reflect.InvocationTargetException: null
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[?:?]
at io.gatling.app.SimulationClass$Java.params(SimulationClass.scala:35) ~[gatling-app-3.9.5.jar:3.9.5]
at io.gatling.app.Runner.load(Runner.scala:72) ~[gatling-app-3.9.5.jar:3.9.5]
at io.gatling.app.Runner.run(Runner.scala:57) ~[gatling-app-3.9.5.jar:3.9.5]
at io.gatling.app.Gatling$.start(Gatling.scala:89) ~[gatling-app-3.9.5.jar:3.9.5]
at io.gatling.app.Gatling$.fromMap(Gatling.scala:43) ~[gatling-app-3.9.5.jar:3.9.5]
Error without using any feeder strategy var feeder = jsonFile(“data/posts.json”)
java.lang.IllegalStateException: Feeder json(post.json) is now empty, stopping engine
at io.gatling.core.action.FeedActor$$anonfun$receive$1.applyOrElse(FeedActor.scala:83) ~[gatling-core-3.9.5.jar:3.9.5]