Test Overview
This test runs a Postman collection using a CSV data file to send multiple requests with different user data. It verifies that the API responds with status 200 for each user.
Jump into concepts and practice - no test required
This test runs a Postman collection using a CSV data file to send multiple requests with different user data. It verifies that the API responds with status 200 for each user.
pm.test('Status code is 200', function () { pm.response.to.have.status(200); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test collection run starts with CSV data file containing multiple user records | Postman Runner opens and loads CSV file with user data rows | — | PASS |
| 2 | Postman sends first request using first row data from CSV (e.g., userId=1, name='Alice') | Request URL and body populated with first user data | — | PASS |
| 3 | Postman receives response for first request | Response status 200 and valid JSON body received | Check response status is 200 | PASS |
| 4 | Postman runs test script to assert status code 200 | Test script executed in Postman sandbox | pm.test('Status code is 200', function () { pm.response.to.have.status(200); }); | PASS |
| 5 | Postman sends second request using second row data from CSV (e.g., userId=2, name='Bob') | Request URL and body populated with second user data | — | PASS |
| 6 | Postman receives response for second request | Response status 200 and valid JSON body received | Check response status is 200 | PASS |
| 7 | Postman runs test script to assert status code 200 for second request | Test script executed in Postman sandbox | pm.test('Status code is 200', function () { pm.response.to.have.status(200); }); | PASS |
| 8 | Postman completes all requests from CSV data file | All rows processed, test results collected | All requests returned status 200 | PASS |
username in a Postman test script?pm.iterationData.get('variableName') to get data from CSV or JSON files.usernamepm.iterationData.get('username').email,password user1@example.com,pass123 user2@example.com,pass456
const email = pm.iterationData.get('email');
const password = pm.iterationData.get('password');
pm.test('Check email format', () => {
pm.expect(email).to.include('@');
});[
{"user": "alice", "age": 30},
{"user": "bob", "age": "twenty-five"}
]age to be a number, you get unexpected failures. What is the most likely cause?[
{"user": {"name": "John", "id": 101}, "active": true},
{"user": {"name": "Jane", "id": 102}, "active": false}
]name property inside the test script?pm.iterationData.get('user'), then access nested properties using JavaScript dot notation.pm.iterationData.get('user').name correctly accesses the nested name.