0
0
Postmantesting~20 mins

Running a collection in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Postman Collection Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output count after running this Postman collection?

You have a Postman collection with 3 requests. Each request returns a JSON response with a field status. The collection runs sequentially and you use a test script to count how many responses have status equal to success.

After running the collection, what is the value of the counter if the responses are: {"status": "success"}, {"status": "fail"}, {"status": "success"}?

Postman
let successCount = Number(pm.environment.get('successCount') || 0);
pm.test('Count success status', function () {
    let jsonData = pm.response.json();
    if (jsonData.status === 'success') {
        successCount++;
    }
    pm.environment.set('successCount', successCount);
});
A1
B2
C0
D3
Attempts:
2 left
💡 Hint

Count only responses where status is exactly success.

🧠 Conceptual
intermediate
2:00remaining
Which environment variable scope is best for sharing data across all requests in a collection run?

You want to store a variable in Postman that is accessible by all requests during a collection run but does not persist after the run ends. Which variable scope should you use?

AGlobal variable
BEnvironment variable
CCollection variable
DLocal variable
Attempts:
2 left
💡 Hint

Think about variables that exist only during the collection run and are shared by all requests in that collection.

📝 Syntax
advanced
2:00remaining
Identify the syntax error in this Postman test script snippet

What error does this Postman test script produce?

pm.test('Response has userId', () => {
  let jsonData = pm.response.json()
  pm.expect(jsonData.userId).to.eql(123);
});
ANo error, script runs successfully
BTypeError: pm.expect is not a function
CSyntaxError: Missing semicolon after pm.response.json()
DReferenceError: jsonData is not defined
Attempts:
2 left
💡 Hint

Check if the code syntax and function calls are correct.

optimization
advanced
2:00remaining
How to optimize running a large collection with many requests?

You have a Postman collection with 100 requests. Running it sequentially takes a long time. Which approach optimizes the total run time?

ADisable tests to speed up execution
BAdd delays between requests to avoid server overload
CSplit the collection into smaller collections and run them one after another
DRun requests in parallel using Postman Runner's concurrency setting
Attempts:
2 left
💡 Hint

Think about running multiple requests at the same time.

🔧 Debug
expert
2:00remaining
Why does this collection run fail to update the variable as expected?

In a collection run, you try to increment a variable counter in the test script of each request like this:

let count = pm.variables.get('counter');
count++;
pm.variables.set('counter', count);

But after the run, counter remains unchanged. Why?

Apm.variables.get() returns undefined because 'counter' is not set initially
Bpm.variables.get() returns a string, so incrementing causes NaN
Cpm.variables.set() updates only local variables, not environment or collection variables
Dpm.variables.set() cannot update variables during collection run
Attempts:
2 left
💡 Hint

Check if the variable exists before incrementing.