restautomationpostmandata-driven-testsrunner

REST Postman How to use datafiles in Runner for more then one endpoint


I like to use the Runner in Postman to run / test a whole collection of endpoints. Each endpoint should get different parameter or request body data on each iteration.

So far i figured out the data file usage for one endpoint. See https://learning.postman.com/docs/running-collections/working-with-data-files/

But is there a way to provide data for more then one endpoint where the endpoints need different variables in the same run?

example:

[GET]categories/:categoryId?lang=en

[GET]articles/?filter[height]=10,40&sort[name]=desc

Datafile for first endpoint:

[{
   "categoryId": 1123,
   "lang": en
},
{
   "categoryId": 3342,
   "lang": de
}]

Datafile for second endpoint:

[{
   "filter": "height",
   "filterValue": "10,40",
   "sort": "name",
   "sortDir": "desc"
},
{
   "filter": "material",
   "filterValue": "chrome",
   "sort": "relevance",
   "sortDir": "asc"
}]

Solution

  • Right now, there is no way to add more data files. https://community.postman.com/t/pass-multiple-data-files-to-a-collection/899

    My suggestion is

    1. Separate each endpoint that need data file into different collections.
    2. Use newman as library to run it all.