Modern QA2026Question 3
Log inJoin
7 / 7 · Book 14 · Exercises · drill: interview Q&A← prev⊞ allGet the book →

1.10Question 3

Prompt: You are building a data-driven test in Postman with a CSV file containing 500 rows of test data. The collection run takes 45 minutes. How do you optimize this?

What a strong answer should cover:

  • Analysis first: identify which requests are slow (network latency vs. test setup)
  • Reducing unnecessary requests (skip redundant auth calls by using collection-level pre-request scripts)
  • Parallelization strategies (splitting the CSV, running multiple Newman instances)
  • Questioning whether all 500 rows are necessary or if equivalence partitioning can reduce to 50 representative cases

Example answer:

  • "First, I would check if each iteration is re-authenticating. If so, I would move the login to a collection-level pre-request script that runs once and stores the token, not per-iteration."
  • "Second, I would apply equivalence partitioning to the CSV. If 400 of the 500 rows test valid inputs with minor variations, I would reduce those to 20 representative cases. The 100 boundary and error cases likely stay."
  • "Third, I would split the remaining CSV into chunks and run multiple Newman instances in parallel using CI matrix jobs. Four parallel runners would cut the time to roughly 25% of the original."
  • "Finally, if 45 minutes is still too long, that is a signal to migrate to pytest with pytest-xdist, which gives true parallel execution with better resource management."

Chapter 2: Newman and pytest -- From Manual to Automated

Postman is excellent for exploration. For CI/CD integration and scalable test suites, you need command-line tools: Newman for running Postman collections from the terminal, and pytest with the requests library for full programmatic control.

This chapter bridges the gap between manual exploration and automated testing. You will learn to run Postman collections in CI pipelines with Newman, then build production-grade test suites with pytest.

2.1 Newman: Postman Collections in CI

Newman runs Postman collections from the command line, making them suitable for CI pipelines without a GUI.