In this series of blog posts, I give short tutorials on how to accomplish something using Postman’s no/low code API feature Flows.
This time it is generating test data. If you need to run a set of steps repeatedly to create data before you can execute your tests, then here’s an easy way to do this, no code required.
Steps:
1. Create a flow of the steps needed to generate data e.g. Send Request then x,y,z.
2. Add a Loop N Times
Block, with an inbound connector of Number
. Select how many iterations you wish to run in the number
block (e.g. I want to create 5 bookings, so will enter 5)
3. After the loop N Times
block, add a Create Data
block. Inside this block, create a list pointing to /data
(in other words, the numeric input to the block that you have created above)
4. Add a For Each
block after the Create Data
block. This will connect to your steps created in step 1 above, and tells flows that you want to iterate through the looped data. Ensure the For Each
block is set to pick up /for
5. Run the Flow and check the data has been correctly generated, hurrah!
Here is a short video running through these in more detail.