Happy new year everybody.
I’m bugging (me) on something…
Our way of feeding data has been decided, we can’t use csv file either json file (too static, to map on any database, without having each time job to do). We will write some REST Services to interrogate the databases (all intelligence stays on the application-server side, nothing is written in gatling except it’s own scripts).
These REST servicies return JSON object in String format.
Example :
private val usersData: String = RestUrlCall.getRestContent("http://127.0.0.1:8888/bench/benchFeeder/testDataFeeder")
Which may returns, depending on databases these type of string, for examples :
[{"id":1144,"name":"NEDOQUE MAX"},{"id":1080,"name":"BLOCQUEAU JULIE"},{"id":1081,"name":"DIETY LILY"}]
I Parse this with Jackson :
val jObject = Jackson.parse(usersData)
(which works fine, I got an ArrayList in return)
And here is where I’m stucked…
How to feed my scenario with these data?
How to transform my parsed String into FeederBuilder[_] ?
Hope the question is not that stupid…
Thank you.
Thank you for helping me.
- I really thought it was THE solution, I tried… but obviously I did not understand how this works… I couldn’t write it…
- I already looked at the JSON feeder but they have to be either in a diskFile or downloadable through an URL, so I can use none of them…
Do someone has en example of a custom build feeder please?
Thank you.
JsonFeeder looks straightforward and simple Can you tell me how you tried it? Can you share your simulation?
The simplest way to implement it would be something like the following:
`
val myFeeder = jsonUrl("[http://127.0.0.1:8888/bench/benchFeeder/testDataFeeder](http://127.0.0.1:8888/bench/benchFeeder/testDataFeeder)")
object test {
val myLoadTest = feed(myFeeder)
.exec(http("name of test").get("<your load test app url>")
.queryParam("id", "${id}") // id from your json array
.queryParam("name", "${name}") // name from your json array.
`
But since I don’t know what you are trying to do with the data, I am not sure if this will work.
Holly SH### it was so simple that I never tryed it this way …
So you just solve my problems…
Thank you very much.
( I’m quite disapointed I didn’t find it on my own, but… )
Jerome
@Abhinav Nice job helping here, thanks a bunch!
Hi Abhinav,
Could you please help me on the Json Feeder?