Good afternoon, colleagues!
I ran into a problem, and I wanted to ask you how it can be solved.
The short description of the problem:
I need to change the path to upload files (body type - form-data) when I export my Postman collection for Newman.
The fact is that my favorite case for using postman is integration tests. But not just integration tests, but automated ones with the help of Newman and docker-compose. The idea of the case is presented in the figure:
A brief description.
The docker-compose file is placed in the project folder, which launches 3 containers: 1 - newman, 2 - application, 3 - database.
All tests are run with one command docker-compose -f docker-compose.test.yml up --exit-code -from newman --build
, or you can add a couple of parameters to taste.
The tests can be run with a pre-installed docker and a downloaded application and that’s it. I used to run tests before pushing the next commit and see that everything was fine.
If you are interested in the technical details of the case, you can find an example of its implementation in my repository https://github.com/SergeyStol/organization-srv .
Everything was going well until I came across an API in which I need to upload a new file. By the way, I completely forgot to write, but this is important, the collection needs to be exported to disk before being used. So, if you export the collection, the file paths are saved for the host machine (in my case, it’s Windows 10), while for Newman the address is /etc/postman/someUploadFile.csv. You have to export the collection, and then manually change the path to the file. Firstly, you need to remember to do it, and secondly, it just takes a lot of time (if there are a lot of tests and a lot of different files). In addition, the probability of making a mistake increases.
Do you have any ideas how to solve it beautifully?