We are trying to increase our usage of Postman for API testing, and as part of this we are coming up against some difficulties, which I was hoping you would be able to help us with, and give us some advice on the best way to achieve what we are looking to do.
We want to create a set of tests, which will build the data required for other tests which will be run, as part of this we want to be able to use multiple JSON data files with the commands.
The workflow would be something along the lines of:
- Run a test to create a new network - this uses a JSON data file for the data to be included in the request, from the response we want to get an auth code
- Using the auth code from test 1, we want to call our authenticate method on our API, which returns an auth token
- Using the auth token from test 2, we want to create a number of users on our network, this would use another JSON file, with an array of objects, and we would want to iterate over the test multiple times
This is a very small section of the tests, but you can see we need to be able to share data taken from the responses of each test, and also use different JSON files for data, which will have different numbers of objects in them.
The postman support team pointed us towards Flows for this, but Flows have their own issues, where you can’t re use blocks across flows, or run multiple flows, you also can’t use external files as inputs for flow variables.
Do NOT include sensitive information like auth tokens or passwords.