Ho to run a test on multiple domains?

Given a GET-request with a test:
pm.test(“Status test”, function () {
pm.response.to.have.status(200);
});

I want to run the request against an Url like this:
https://{{domain}}/api/schema

I have specified multiple postman-environments:
VARIABLE: domain
INITIAL VALUE: example.com
(…)

How do I run this request with all available environments? I want to be able to run all tests and check all domains after deployment with a single click (or cli command).

The COLLECTION RUNNER can import variables from CSV-files, but the variables are not permanently added to the request. I want to able to share the entire testsuite with my team without any additional configuration needed (postman-workspace or git).

Thank you

@sebastianstucke87 Is there a possibility to do this in Monitor?

My original answer does NOT work for multiple environments: newman can only be run with one environment at a time.

@jency.stella19
As for the postman-monitor: It does NOT work. Postman monitors only work with one environment. You would have to duplicate your individual collections, set the environment and duplicate the settings (alert emails etc.) to run your collections with different environments.

All this duplication just to run a postman monitor with different environments is just not feasible.

(If this is wrong, please correct me. I’m all ears!)

As for monitoring APIs: one check every 20 minutes and re-check after 5-10 minutes in case of failure + alert should be a fair suggestion. The postman-limitations of 10k requests/month just don’t add up (10k req/months is the same for all paying customers: “Team”, “Business” and “Enterprise”).

As an alternative to postman, you might want to try the jetbrains “.http”-request (+ tests) with a custom cli-runner:

This does NOT support multiple environments either, BUT it is way easier to use (no sign-up, no npm install, no confusing UI) and you have code completion.

All you need is a server + cron + a simple script to loop over some environments + some notification service for alerts.

Could be fun little raspberry project :slight_smile:

Will have a look on this thank you :slight_smile:

  1. You need a CSV with your environment variables. Content of example_environments.csv:

    domain example_1
    bing.com A
    duckduckgo.com B
    google.com C
  2. Export postman-collection as described here: https://blog.scottlogic.com/2020/02/04/GraduateGuideToAPITesting.html#exporting-postman-collection:~:text=Exporting%20Postman%20Collection

  3. Run $ newman run example_collection.json -d example_environments.csv

  4. ???

  5. PROFIT!