Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{
- "testSequence": ["First request name", "Second request name", "..." ],
- "anyOtherData": "Whatever the request needs",
- "evenMoreData": "Whatever the request needs",
- "...": "..."
- },{
- "testSequence": ["Login", "Check newsfeed", "Send a picture", "Logout" ],
- "username": "Example",
- "password": "correcthorsebatterystaple",
- },{
- "...": "keep the structure for any other test scenario or request sequence"
- }]
- // Use the mechanism only if there is a test scenario file
- // This IF prevents the block from firing when running single requests in Postman
- if (pm.iterationData.get("testSequence")) {
- // Is there another request in the scenario?
- var sequence = pm.globals.get("testSequence");
- if ((sequence instanceof Array) && (sequence.length > 0)) {
- // If so, set it as the next one
- var nextRequest = sequence.shift();
- pm.globals.set("testSequence", sequence);
- postman.setNextRequest(nextRequest);
- } else {
- // Otherwise, this was the last one. Finish the execution.
- postman.setNextRequest(null);
- }
- }
Add Comment
Please, Sign In to add comment