QA Interview Hub · Knowledge base · Quizzes · Українська

API › Runner, data-driven tests and Newman

Postman's limits

Postman suits exploring an API and quick checks, while a large regression suite with logic and git review is better kept in code. A new endpoint is explored in Postman and stable scenarios move into automated tests, but a small suite run in CI through the Postman CLI need not be moved on principle. Newman gets no updates and stays only in older pipelines.

API · Runner, data-driven tests and Newman

A collection has grown to a hundred requests and its JSON diff is unreadable. What now?

A collection started with ten requests and now has a hundred, with scripts that copy one another. A pull request shows a thousand-line JSON diff in which you cannot see what changed. Someone asks whether to move it to code. The answer is not "Postman is bad" but "each tool has its job": this lesson is about where the line is.

How it works and why it is designed so

Postman is built for working with an API by hand: send a request, look at the response, save an example, share with the team. That is why it is strong at exploring a new endpoint, quick checks and shared documentation with developers. Code is built for maintaining logic over time: functions, types, review, reuse. A regression set with logic, data factories and review in git is easier to maintain in code: Playwright request, Cypress cy.request, RestAssured.

Postman or code

Postman

Exploring and quick checks

A new endpoint, a manual run, shared documentation with developers, a mock and a monitor.

Code

Regression suite

Logic, data factories, review in git, one CI and reporting together with UI tests.

Figure 1. Both tools are legitimate, they answer different questions.

The reasons regression is moved to code:

  • An exported collection in JSON reads poorly in a diff (the newer Postman format with separate YAML files per request improves this), and reviewing script changes is awkward;
  • Logic is harder to reuse: helpers, test data factories, shared fixtures;
  • In code API tests live next to UI tests, with the same CI, reporting and types;
  • In TypeScript API tests types generated from OpenAPI show at compile time which tests a schema change touched, and schema validation at run time catches a mismatch with the real response.

Example: the same case in two places

The check in Postman looks like this:

// Postman: post-response of POST /transfers
pm.test('Transfer created', () => {
  pm.response.to.have.status(201);
  pm.expect(pm.response.json().amount).to.eql(150);
});

And here it is in code. The difference is not the request but that the test is now an ordinary file: it shows in a diff, can be parameterised, can use an extracted helper, run next to UI tests and be typed.

// Playwright: the same case in code, baseURL in the config
import { test, expect } from '@playwright/test';

test('POST /transfers creates a transfer', async ({ request }) => {
  const res = await request.post('/transfers', {
    data: { amount: 150, currency: 'UAH' },
  });
  expect(res.status()).toBe(201);
  expect((await res.json()).amount).toBe(150);
});

When to choose which

The table sums up the difference by the criteria that drive the choice:

PostmanCode
StartA request in minutesNeeds a project and config
ScriptsJavaScript in pm.*Project language, types
ReviewDiff of collection JSON or YAMLCode diff
Logic reuseCollection scripts, Package LibraryFunctions, modules, fixtures
CIPostman CLI (Newman gets no updates)The same pipeline as UI
Who maintainsManual and automation QAPeople who write code
  • Postman: a new endpoint, a manual run, shared documentation with developers, a mock and a monitor, a small set where nobody reviews scripts;
  • Code (Playwright request, RestAssured): a regression suite with logic and data factories, review in git, one CI with UI tests. RestAssured fits when the team's automation is in Java, Playwright request or cy.request when it is in JS/TS and UI tests already sit beside it.

Limits and alternatives

This is not an either-or choice. A workflow that has proven itself: a new endpoint is explored in Postman first (importing OpenAPI saves time at the start) and stable scenarios are moved into automated tests. Postman stays for documentation, a mock server, a monitor and quick manual checks. If the team is small, the set is small and nobody reviews scripts, a collection that CI runs through the Postman CLI is quite enough: migrating on principle is not worth it. Postman no longer updates Newman and recommends replacing it with the Postman CLI, so Newman stays only in older pipelines.

Common mistakes

  • Moving everything to code without a reason. You lose exploration speed and the gain is small for a small set;
  • Keeping regression in a collection with dozens of script helpers. Logic is copied and review is impossible;
  • Duplicating the same case in both Postman and code. A month later they diverge and nobody knows which to trust;
  • Dismissing Postman outright. For documentation and manual checks it is often more efficient.

Check yourself

Name two reasons a large API regression set is moved from a Postman collection to code.

Answer

Review in git (the collection JSON reads poorly in a diff) and reuse of logic (helpers, data factories). Also: a single CI with UI tests and types from OpenAPI that show the effects of schema changes.

What is Postman still useful for even when regression is in code?

Answer

For exploring new endpoints, quick manual checks, shared documentation with developers, and a mock server and a monitor.

In an interview. Junior: Postman is for exploration and quick checks, while I keep a large regression set in code, for example on Playwright request, next to UI tests and with review in git. That makes logic easier to reuse and tests easier to maintain. Middle/Senior: The decision depends on team size and make-up: I explore a new endpoint in Postman, move stable scenarios to code and leave documentation and the mock in Postman. I would not migrate a small set that runs in CI through the Postman CLI on principle. Newman stays only in older pipelines: it gets no updates.

More articles in this chapter