0
0
Postmantesting~20 mins

Iteration count in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Iteration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the iteration count value after the 3rd request?

In Postman, you run a collection with 5 iterations. You use this script in the Tests tab:

pm.test("Check iteration", () => {
    pm.expect(pm.info.iteration).to.be.a('number');
});

What is the value of pm.info.iteration during the 3rd request?

A2
B3
C0
D1
Attempts:
2 left
💡 Hint

Remember, iteration count starts at zero in Postman.

assertion
intermediate
2:00remaining
Which assertion correctly checks the iteration count is less than 5?

You want to write a test in Postman to verify the current iteration count is less than 5. Which assertion is correct?

Apm.test('Iteration less than 5', () => { pm.expect(pm.info.iteration).to.be.below(5); });
Bpm.test('Iteration less than 5', () => { pm.expect(pm.info.iteration < 5); });
Cpm.test('Iteration less than 5', () => { pm.expect(pm.info.iteration <= 5); });
Dpm.test('Iteration less than 5', () => { pm.expect(pm.info.iteration).to.be.lessThan(5); });
Attempts:
2 left
💡 Hint

Check the syntax for Chai assertions in Postman.

🔧 Debug
advanced
2:00remaining
Why does pm.info.iteration always show 0 in your tests?

You run a Postman collection with multiple iterations, but your test script always logs pm.info.iteration as 0. What is the most likely reason?

AThe iteration count resets to 0 after each request in the collection.
BYou are running the request individually, not as part of a collection run with iterations.
Cpm.info.iteration is only available in the Pre-request Script tab, not Tests tab.
DYou need to enable iteration count in Postman settings before it works.
Attempts:
2 left
💡 Hint

Think about how Postman handles iteration count when running single requests vs collection runs.

🧠 Conceptual
advanced
2:00remaining
What does pm.info.iteration represent in Postman?

Choose the best description of pm.info.iteration in Postman scripts.

AThe number of times the current request has been retried.
BThe total number of iterations completed so far in the collection run.
CThe number of requests sent in the current iteration.
DThe zero-based index of the current iteration in a collection run.
Attempts:
2 left
💡 Hint

Think about what iteration means in a collection run context.

framework
expert
2:00remaining
How to run a Postman collection exactly 10 times using Newman CLI?

You want to run a Postman collection 10 times in a row using Newman from the command line. Which command correctly sets the iteration count?

Anewman run collection.json --count 10
Bnewman run collection.json --iterations 10
Cnewman run collection.json --iteration-count 10
Dnewman run collection.json --repeat 10
Attempts:
2 left
💡 Hint

Check Newman CLI documentation for the correct flag to set iteration count.