Sebi
Sebi

Reputation: 4522

Running battery of tests in postman

Is it possible to run many requests in a postman script; I have an endpoint:

http://localhost/gadgets/{id}/buy

Which sets a flag in a gadget object/entry given its id. I have hundreds of gadgets. Is it possible to have a shared file of ids that I can create requests from and run them independently?

https://learning.postman.com/docs/running-collections/intro-to-collection-runs/

and

https://learning.postman.com/docs/writing-scripts/intro-to-scripts/

don't seem to do this.

Edit:

data.json:

{
"gadget_ids":
            [
                "8f338a25-c52a-4c47-9d5f-69a6c48c24f2",
                "32461687-530e-4730-86c4-00fa4c284cd9",
                "913ab956-b89d-41a2-9c09-0a970e202440",
                "55c30784-3ad1-4a4e-a781-51a6f0f2fa42"
            ],
"users_ids":
            [
                "4b1c6bc3-d44d-492b-8360-d5076913578b",
                "db0722e7-3224-4db1-8a94-372ab462ae70",
                "8d0f87f1-6697-4e08-8ddd-0e34e2015787",
                "9d788283-87a9-4c38-8d48-30ddc1604058",
                "8a86b353-df4c-40fd-a5a1-cfa5f27c41c4",
                "a67485e5-fb13-4863-ab55-01fd58c2600f",
                "3ab7211d-99e7-4cc6-a862-ac106c2a24de",
                "378b2e77-7e18-4d75-b780-c9281b86c8ee",
                "df1e35ca-37c5-4026-aa59-ebc02e348fdf",
                "2e0aadab-efe2-42e5-9088-c0bb1c6c9631"
            ]           
}

gives a something went wrong error while importing. Apparently, it's expecting an array but the JSON structure is not mentioned anywhere.

Upvotes: 0

Views: 221

Answers (1)

Christian Baumann
Christian Baumann

Reputation: 3435

The Collection Runner is what you're looking for. You can provide the different IDs via a data file (either CSV or JSON format).

It's described in detail here: https://learning.postman.com/docs/running-collections/working-with-data-files/

Upvotes: 1

Related Questions