Is there a way to tell if a request is being made from Collection Runner, or Monitor?

Sorry if I missed this, but I couldn’t find anything in documentation. Is there a way to tell if a request is being made directly from inside Postman, or some other direct method, or if its being run from Collection Runner, or a Monitor? Is there some variable that would indicate this? Basically, I would run different tests if I knew it was being run from within Collection Runner.

Hey @cptvitamin,

Welcome to the community!

I’ll be happy to help. I don’t believe there is an out-of-the-box variable that you’d be able to access to differentiate. However, the following should help:

You could always create a variable in your Environment, e.g. runType and set its initial value to monitor ( To sync with the server when running your monitor and make sure the value is picked up )

You would then export that Environment as a JSON and then change the value of runType locally to newman for example. You could then use Newman to run your collection with the --environment being the JSON file you explored with the newman value.

I’m assuming your familiar with writing test scripts, considering your question is that correct? If not, I’d suggest reading the following:

You could then do something like the following in your tests:

if(pm.environment.get("runType") === "monitor"){
pm.test("Status code is 200", function () {;

Hopefully, this helps. And welcome again!

1 Like