0
0
Postmantesting~20 mins

Data file integration (CSV, JSON) in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Data File Integration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Postman test script when using a CSV data file?

Given this test script in Postman that runs with a CSV data file containing two rows:

pm.test('Check user ID', () => {
    pm.expect(pm.iterationData.get('userId')).to.be.oneOf(['101', '102']);
});

What will be the result after running the collection with this CSV data?

Postman
pm.test('Check user ID', () => {
    pm.expect(pm.iterationData.get('userId')).to.be.oneOf(['101', '102']);
});
AThe test throws a runtime error due to invalid syntax.
BThe test fails because pm.iterationData.get does not work with CSV files.
CThe test passes twice, once for each userId in the CSV file.
DThe test passes only once, ignoring the second CSV row.
Attempts:
2 left
💡 Hint

Think about how Postman runs tests for each row in a data file.

assertion
intermediate
2:00remaining
Which assertion correctly verifies a JSON data file value in Postman?

You have a JSON data file with entries like {"username": "alice"}. Which assertion in the test script correctly checks that the username is 'alice' for the current iteration?

Apm.expect(pm.iterationData.username).to.equal('alice');
Bpm.expect(pm.iterationData.get('username')).to.eql('alice');
Cpm.expect(pm.data.username).to.equal('alice');
Dpm.expect(pm.data.get('username')).to.eql('alice');
Attempts:
2 left
💡 Hint

Remember the method to get data from the current iteration in Postman.

🔧 Debug
advanced
2:00remaining
Why does this Postman test fail when using a JSON data file?

Consider this test script:

pm.test('Check email', () => {
    pm.expect(pm.iterationData.email).to.include('@');
});

When running with a JSON data file containing emails, the test always fails. What is the cause?

Postman
pm.test('Check email', () => {
    pm.expect(pm.iterationData.email).to.include('@');
});
Apm.iterationData is a method, so pm.iterationData.email is undefined causing the test to fail.
BThe test syntax is invalid because include() is not a valid assertion method.
CThe JSON data file is malformed, so pm.iterationData cannot read email.
Dpm.iterationData.email is correct, but the email values do not contain '@'.
Attempts:
2 left
💡 Hint

Check how to properly access iteration data in Postman scripts.

framework
advanced
2:00remaining
How to configure Postman to run a collection with a JSON data file?

Which step correctly describes how to run a Postman collection using a JSON data file?

AIn the Collection Runner, select the collection, click 'Select File', choose the JSON file, then click 'Run'.
BImport the JSON file as a new collection, then run it directly without selecting a data file.
CAttach the JSON file in the request body and run the collection normally.
DConvert the JSON file to CSV first, then use the Collection Runner to select the CSV file.
Attempts:
2 left
💡 Hint

Think about how Postman uses data files in the Collection Runner.

🧠 Conceptual
expert
3:00remaining
What is the main difference in handling CSV vs JSON data files in Postman tests?

When using CSV and JSON data files in Postman Collection Runner, what is the key difference in how data is accessed in test scripts?

ACSV data must be converted to JSON before use; JSON data can be used directly.
BCSV data requires pm.iterationData.get('key'), but JSON data uses pm.data.key directly.
CCSV data is accessed by index, JSON data by key name in pm.iterationData.
DThere is no difference; both use pm.iterationData.get('key') to access values.
Attempts:
2 left
💡 Hint

Consider the Postman API for accessing iteration data regardless of file type.