skip to content

Batch Execution

Running a whole saved file at once instead of one request at a time: what feeds it rows, which part of the tree it covers, and what starts it outside the app.

part ofAPI & DB clientsoverview, primer and where to startread it →
on this pageshow

explore

questions

13

When a saved Postman collection is run from a terminal instead of the app, what must be supplied explicitly?

level: juniorimportance: must knowfreq 58%

answer

  1. The file is a document, not a session
  2. App-side state does not export
  3. Each input is named or absent
  4. One transport setting has no flag at all

basics

~20 s

A terminal run gets only the collection file plus what the command line hands it. The app's selected environment, its accumulated cookies and its transport settings are app-side state; anything the requests depend on must be passed explicitly.

solid answer

~40 s

The exported collection carries **requests, folders, the scripts on them and the collection's own variables** — nothing else. The environment you had selected, values earlier activity wrote, the cookie jar the session accumulated, and the certificates and proxy held in the application's settings all stay behind, so each has to be named on the command line or it is simply absent. Two of them behave differently and are worth knowing: a client certificate *can* be handed over, but `--ssl-client-cert` appends its entry at the **end** of the run's certificate list with an `<all_urls>` match, so a host-scoped entry already there wins; and a **proxy has no command-line option at all**, so a proxy the app applied never travels. Treat the export as request definitions only and make every other input explicit.

code

bash · 4 lines
bash
newman run ./collection.json \
  -e ./environment.json \
  --ssl-client-cert ./client.pem \
  --ssl-client-key ./client.key

go deeper

for a junior

Be ready to say what an exported collection actually contains: requests, folders, their scripts and the collection's variables. Everything else you saw working in the app has to be supplied again at the command line.

for a middle

Explain the mechanics of the handover input by input — which ones the file carries, which ones an argument can name, and which ones have no argument at all. Name the two transport surprises precisely.

for a senior

Show that you diagnose a failing terminal run by auditing inputs rather than re-exporting the collection, and that you prove the run on the machine that will perform it instead of on a laptop that already sits on the right network.

for a principal

Own the position that a collection driven only by clicking has invisible dependencies. Argue for describing runs as commands from the start, so implicit inputs are discovered by review rather than one production failure at a time.

## The collection file is a document, not a session A saved Postman collection is a JSON document. It holds the **requests**, the **folders** that order them, the scripts hung on those items, and the collection's own variables. That is the whole of what an export carries. Everything else that made a request succeed while you were clicking in the application — the environment selected in the picker, the values an earlier click wrote into it, the cookies the session accumulated, the client certificates and the proxy sitting in the application's own settings — is **state beside the document**, held by the application, not inside the file. A terminal run begins with none of that. It has the file you name and the arguments you type, and nothing more. That is the whole of the handover problem: an app run is a *session* with implicit inputs, and a terminal run is a *command* whose inputs are only the ones you spelled out. ## What the application was supplying implicitly - **A selected environment** — the picker in the app is a choice, not part of the collection; at a terminal that file has to be named on the command line (`-e`) or its values are simply absent. - **Values written by earlier activity** — a token a prerequest script stored during yesterday's clicking is in the app's copy of a value store, not in the exported requests. - **Accumulated cookies** — the app's jar filled up over a session; a fresh run starts empty unless a serialized jar is handed to it. - **Transport settings** — client certificates and a proxy live in the application's settings, beside the collection rather than in it, and they are the two that behave *differently* from each other. - **A working directory** — anything the run reads from disk resolves against wherever the command was invoked, not against wherever the collection was exported from. ## What can be handed over, and what cannot | Input the app supplied | In the exported file? | Can a command line supply it? | |---|---|---| | Requests, folders, the scripts on them | Yes | not needed | | The collection's own variables | Yes | not needed | | A chosen environment of saved values | No | Yes — the file is named as an argument | | Cookies accumulated in a session | No | Only by handing over a serialized jar | | A client certificate and its key | No | Yes — but the entry lands **last** in the list | | A proxy for outbound calls | No | **No option exists at all** | ## The two asymmetries worth memorising 1. **A certificate travels, but at the bottom of the pile.** `--ssl-client-cert` does not override anything: the entry it builds is **appended to the end** of the run's certificate list and carries an `<all_urls>` match pattern. Resolution takes the first entry whose pattern covers the URL, so a host-scoped entry already in the list is reached first and the flag becomes a catch-all fallback. 2. **A proxy does not travel at all.** There is no command-line option that puts a proxy in front of a terminal run. Whatever the application was doing quietly for you stops at the app boundary, and the only proxying a terminal run gets is what its own machine puts in front of the process. Those two are the ones that produce the "but it works in the app" bug report, because both fail *silently*: the run does not warn you that a certificate was shadowed or that a proxy is missing. It just makes a different call than the one you watched succeed. ## A working rule for the first terminal run - Treat the export as **request definitions only**, and assume every other input is missing until you named it. - Enumerate the value stores the requests actually read, and confirm each one is either inside the file or passed as an argument. - Prove the run **on the machine that will do it** — a laptop that already sits behind the same network is a bad witness for a build agent that does not. - Expect the first failure to be **transport**, not assertions: a call that never connects and a call that connects and returns the wrong body are different problems with different missing inputs. - Keep the paths the run reads relative to a known directory, so the same command means the same thing on someone else's machine. The habit that makes all of this cheap is to describe the run as a command from the beginning. If the collection has only ever been driven by clicking, its implicit inputs are invisible, and you discover them one failure at a time on the machine least convenient for debugging.

  • Which of those implicit inputs has no command-line representation at all?
    The proxy. There is no option that carries one, so a proxy the application was applying stops at the app boundary; a terminal run is proxied only by what its own machine puts in front of the process. Every other input in this list can at least be named as an argument, which makes the proxy the one that gets discovered by failure rather than by reading the command.
  • Why is a green run in the app not evidence that the terminal run will pass?
    Because the two runs have different inputs. The app run drew on a session — a selected environment, values written earlier, accumulated cookies, settings held in the application — and the terminal run has only the file and the arguments. The first terminal run is effectively a new environment bring-up, and it should be proved on the machine that will actually perform it.

saying these in an interview costs you the question

  • Assumes exporting a collection carries the selected environment with it
  • Thinks the app's proxy setting travels inside the collection file
  • Believes a command-line certificate always overrides everything else
  • Treats a green app run as proof the terminal run will pass
  • Debugs the requests before checking which inputs were never named
open as a page

In a Newman command line, what does the `-d` data file do to a collection run, and how does a script read the current row?

level: juniorimportance: must knowfreq 70%

basics

~10 s

Newman's -d flag takes a data file and runs the whole collection once per row. Each row becomes that iteration's pm.iterationData scope, so a script reads its columns with pm.iterationData.get('column').

open as a page

In a Newman command line, what does the `--folder` option select from a collection?

level: juniorimportance: must knowfreq 70%

basics

~10 s

In Newman, --folder narrows a run to one part of the collection: it takes the name or id of a folder or of a single request, and only that subtree executes.

open as a page

In a Newman run, what happens when `-n` asks for more iterations than the `-d` data file has rows?

level: middleimportance: must knowfreq 52%

basics

~10 s

Newman neither wraps nor fails: iterations past the data file's last row repeat that last row. A count smaller than the row count simply runs the leading rows and never reaches the rest.

open as a page

Two folders in a Postman collection share a name — which one does Newman's `--folder` run?

level: middleimportance: must knowfreq 55%

basics

~10 s

The first match wins and only it runs. Newman's --folder lookup compares ids and names and takes own children before deeper ones, so a top-level folder beats a same-named folder nested further down.

open as a page

In Newman, what happens when several `--folder` values are given and one matches nothing?

level: seniorimportance: must knowfreq 45%

basics

~10 s

The whole run aborts. Several --folder values switch the entry-point lookup to its multiple-value form, which requires every value to resolve, so one unmatched name prevents even the matched folders from running.

open as a page

Why can a Newman run present a different client certificate than the one passed with --ssl-client-cert?

level: middleimportance: should knowfreq 38%

basics

~20 s

The flag does not override anything. Its entry is appended to the end of the run's certificate list with a match pattern covering all URLs, and the first matching entry is used, so any earlier host-scoped entry wins.

open as a page

What happens to a proxy configured in the Postman app when the same collection is run from a terminal?

level: middleimportance: should knowfreq 34%

basics

~20 s

It does not travel. There is no command-line proxy option at all, so a proxy the app applied stays behind; a terminal run is proxied only if its own host environment puts one in front of the process.

open as a page

In a Postman script, what do `pm.info.iteration` and `pm.info.iterationCount` report during a data-driven run?

level: middleimportance: should knowfreq 40%

basics

~20 s

pm.info.iteration is the zero-based index of the iteration currently executing; pm.info.iterationCount is how many iterations the run was asked to perform — the requested count when one was given, otherwise the data file's row count.

open as a page

In Newman, what runs when a `--folder` value matches a request rather than a folder?

level: middleimportance: should knowfreq 40%

basics

~20 s

Just that one request. Newman's --folder lookup matches requests as well as folders, so a value naming a single request makes that request the run's entry point and nothing else in the collection is sent.

open as a page

A Postman collection passes in the app but fails on a build agent's terminal run — how do you diagnose it?

level: seniorimportance: should knowfreq 31%

basics

~20 s

Audit the handover before the collection. The app supplies inputs implicitly from a session; a terminal run has only the file and the arguments. Split the failure by whether the call connected, then check which input was never named.

open as a page

A nightly Newman run reports twenty passing iterations but the data file holds eight rows — how do you diagnose that?

level: seniorimportance: should knowfreq 34%

basics

~20 s

An iteration count pinned above the data file's row count is the usual cause: iterations past the last row replay that row, so the run stays green while covering nothing new. Drop the count and let the rows govern.

open as a page

How do you stop `--folder` selections against a shared Postman collection from running the wrong subtree?

level: principalimportance: should knowfreq 28%

basics

~20 s

Treat entry names as an interface. Keep them unique file-wide because the lookup is not path-scoped, review renames as breaking changes, keep selection lists short, and verify which requests ran rather than only the verdict.

open as a page