Collection runner with file uploads

tests
#1

I know that this is currently unavailiable.

But i don’t find it in feature requests, so… this is it. )

10 Likes

Set Body-File via Pre-Request-Script?
#2

Is it still not possible to upload a file from a Request inside a Collection when using Runner? I have Postman 6.7.3 at the moment. The Requests in my Collection are sequential, and I can’t run just the one that does a file upload from the Request Builder. So, to finish writing my test suite, I need the ability to run all the requests. Using the Runner is convenient. Exporting the Collection, modifying all the request.body.formdata[x].srcproperties, and then running it in the shell with Newman is less convenient.

I wouldn’t mind using a Pre-request Script to manipulate the Request before the Runner executes it. However, I see on a GitHub Issue that the pm.request.body is read-only. At least it was back then. It’s hard to know what the current status is.

0 Likes

#3

Since old school file uploads are so problematic (for so many reasons), I’ve decided to modify my API so the client can upload a file as a traditional multipart/form-data POST, or alternatively the encoded file content can be part of a raw request body. This side-steps the trouble of pairing some literal file on the filesystem with the test being executed. It’s a little tricky to support both mechanisms. This workaround becomes impractical for Postman Requests with files larger than ~1Mb, mostly due to delay in syncing the Postman data. Any public API supporting this mechanism will want to have an upstream request body size limiter in place.

Another possible workaround would be to have the client send a reference to the file, rather than the file itself – perhaps a path to a AWS S3 object or a file in Dropbox. I didn’t want to consider the security issues and performance problems with this approach though.

0 Likes

#4

+1 on this request. We are currently using Postman to test a file upload tool, and we have automated tests that run through Newman. Every time I change our collection I download the json file and then manually change it to include the file location for upload. This is cumbersome and time-consuming. It would be great to have a way to save the file needed in Postman itself so it would export whenever we export the collection.

0 Likes

#5

There is always the option of creating python script that added the files needed to the suit of tests automagically and then runs the newman script. It shouldn’t be too hard to write if you know python at all.

0 Likes

#6

I have file uploads working in the workspace, however when I run it in the Collection Runner and Monitor, it fails. The workaround seems to be to use Newman, but as pointed out in this thread, this is not convenient. Can Postman support please confirm when this will be fixed?

0 Likes