Sounds about right.
I’m sure there are many different ways you can organise your collections to make them DRY.
I think I do something similar in my collection for our Customer Returns project, where every “Test Scenario” would be a collection.
I have 4 collections at the top level for each “item” type.
- Customer Return Related Tests
- Tests relating to the product that is returned to the warehouse (URN = Unique Reference Number)
- Tests relating to our “Putaway” process where items are shelved back in our warehouse after being returned.
- And finally, tests relating to creating a Supplier Return (A return that is down to the supplier’s responsibility)
So if we look in the “[B] URNs” collection, a prerequisite for every sub-collection in my URNs collection is to create a brand new URN in our database. This used to be a POST request that was added at the top of every sub-collection, which was a nightmare to maintain.
So I added a “Before Each URN” collection where I have the POST request to create a URN. So I’ve cut down from reusing the same request 10 times, to once.
I’m doing this by using the “postman.setNextRequest” command a lot - this, to me, is one of Postman’s most valuable methods that isn’t talked about enough.