I need to post some data to the server exactly once at the beginning of the test run, and then delete it when the scenario completes. I found the Hooks section in the docs. I would LIKE to be able to use standard http().post() syntax in these blocks. The documentation doesn’t say. Is that doable?
I am also interested in this. If there is a way to do some initial processing before starting load test, it will be a big relief.
Is it on the roadmap?
First, it would probably require a huge effort to not trigger all the load test related stuff (reporting, resources, etc…). Gatling DSL components are builders, not code that is executed on the spot.
Then, those hooks are very generic and you can use them for triggering whatever code you want.
Maybe it would be different hooks from the “arbitrary code” before/after hooks, maybe call them setup or startup and teardown. But what if they were implemented by injecting 1 user, calling the setup chain, waiting for the chain to terminate, then calling the scenario the way you currently do? When the scenario finishes, inject another user to execute the teardown chain. Because as far as I am concerned, the requests made by the startup and teardown should be a part of the reports, and if I want to omit them, there is a facility for that. Thoughts?