0
0
Postmantesting~20 mins

Collections and folders in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Postman Collections Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Postman Collection Structure

Which statement best describes the relationship between collections and folders in Postman?

AFolders are used to group requests inside a collection to organize them logically.
BCollections are subsets inside folders to separate different API endpoints.
CFolders exist outside collections and cannot be part of any collection.
DFolders and collections are the same and can be used interchangeably.
Attempts:
2 left
💡 Hint

Think about how you organize files on your computer into folders inside a main folder.

Predict Output
intermediate
2:00remaining
Output of Folder Count in a Collection

Given a Postman collection JSON with 3 folders, what will be the output of the following test script counting folders?

Postman
const folderCount = pm.collection.folders.count();
console.log(folderCount);
A0
Bundefined
C3
DError: pm.collection.folders is not a function
Attempts:
2 left
💡 Hint

pm.collection.folders.count() returns the number of folders in the current collection.

assertion
advanced
2:00remaining
Correct Assertion for Folder Existence

Which assertion correctly verifies that a folder named 'User APIs' exists in the current Postman collection?

Postman
const folderNames = pm.collection.folders.all().map(folder => folder.name);
Apm.test('Folder exists', () => pm.expect(folderNames).to.equal('User APIs'));
Bpm.test('Folder exists', () => pm.expect(folderNames).to.include('User APIs'));
Cpm.test('Folder exists', () => pm.expect(folderNames).to.have.property('User APIs'));
Dpm.test('Folder exists', () => pm.expect(folderNames).to.be.true);
Attempts:
2 left
💡 Hint

Check if an array includes a specific string.

🔧 Debug
advanced
2:00remaining
Debugging Folder Access Error

Why does this Postman test script throw an error: TypeError: pm.collection.folders.map is not a function?

Postman
const folderNames = pm.collection.folders.all().map(folder => folder.name);
pm.test('Check folders', () => pm.expect(folderNames.length).to.be.above(0));
Apm.collection.folders is undefined because the collection has no folders.
BThe map function is misspelled and should be maps().
CThe test script is missing a required import for map function.
Dpm.collection.folders is an object, not an array, so map() is not available.
Attempts:
2 left
💡 Hint

Check the data type of pm.collection.folders before using array methods.

framework
expert
3:00remaining
Best Practice for Organizing Large API Tests in Postman

For a large API project with hundreds of requests, which approach best uses Postman collections and folders to maintain test clarity and reusability?

ACreate one collection with folders grouping requests by resource type, and use folder-level pre-request and test scripts for shared setup and assertions.
BCreate separate collections for each API endpoint without folders to keep things simple.
CPut all requests in a single folder inside one collection and duplicate pre-request scripts in each request.
DAvoid using folders; instead, use environment variables to separate requests logically.
Attempts:
2 left
💡 Hint

Think about grouping related requests and sharing setup code efficiently.