Im using JSON file as a Feeder for my simulation. At before() hook. I found that the content from feeder files was read and stored inside session API before code from `before()’ hook executed. At this stage (before hook) I’m updating the JSON file - and unfortunately those updates will be applied to second run of tests.
Is it possible to dynamically update feeder file during before() hook?
Thanks for update but still I have a doubts about the content of feeder file
I made a test where I change some details directly in the feeder file.
I want to update the content before the tests (that’s why I checked before hook). Unfortunately during simulation the session had default content of file, not the updates from before hook
Code for update was working fine, I can see that the file was updated
I’m also thinking about using Function for a feeder: Gatling - Feeders
And here inside the function read default content of my file, made some updates and returned updated content - will be fine? This time necessary to process feeders is somehow added to simulation time? And more important for every virtual user Function will be called? Or only once, globally for simulation?
@slandelle
I tried with the CSV files and batch mode only but my feeder file contains only one record so all my tries failed, and it was not possible to dynamically change value inside feeder file during before hook.
Another question is about performance of transform() method: transform records
What If during transform I will update value of particular key using value stored at some let say Singleton class or any other class with the static field where my content will be updated once during before hook? It’s “heavy” task from simulation point of view?