I’m trying to upload a file using gatling.
I’m using multi-part requests for this purpose.
I want to be able to pre-process the file before I upload it (The file itself is a spreadsheet who’s data I intend to modify at runtime (using Apache POI) before uploading the file)
Checking the gatling documentation
I see there is one pre-processor for zipping the payload. Gatling - HTTP Request.
In the below snippet, the ‘file’ argument to RawFileBodyPart’ expects the path to the file
Is it possible to generate this path at runtime ? How can I achieve this ?
The filePath argument of the RawFileBodyPart is a Gatling Expression Language. So you can put a lambda (or a function in scala) there to be able to compute at runtime the String representing your wanted path.
Hey Thanks Sebastien for the prompt reply, I’ll try this out! just one last add-on query.
While writing/reading the file I don’t want to specify an absolute path on the filesystem. I’d like to specify some kind of relative path that would work irrespective of where I run my test.
For Feeders or when specifying request payloads from a file, the resources folder is where this data goes. Is there a directory where dynamically generated data can go ?
If I were to specify just the file name in the “path” variable in your example, would it still work ?