Guest User

Untitled

a guest
May 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. [{
  2. "testSequence": ["First request name", "Second request name", "..." ],
  3. "anyOtherData": "Whatever the request needs",
  4. "evenMoreData": "Whatever the request needs",
  5. "...": "..."
  6. },{
  7. "testSequence": ["Login", "Check newsfeed", "Send a picture", "Logout" ],
  8. "username": "Example",
  9. "password": "correcthorsebatterystaple",
  10. },{
  11. "...": "keep the structure for any other test scenario or request sequence"
  12. }]
  13.  
  14. // Use the mechanism only if there is a test scenario file
  15. // This IF prevents the block from firing when running single requests in Postman
  16. if (pm.iterationData.get("testSequence")) {
  17.  
  18. // Is there another request in the scenario?
  19. var sequence = pm.globals.get("testSequence");
  20. if ((sequence instanceof Array) && (sequence.length > 0)) {
  21.  
  22. // If so, set it as the next one
  23. var nextRequest = sequence.shift();
  24. pm.globals.set("testSequence", sequence);
  25. postman.setNextRequest(nextRequest);
  26.  
  27. } else {
  28. // Otherwise, this was the last one. Finish the execution.
  29. postman.setNextRequest(null);
  30. }
  31. }
Add Comment
Please, Sign In to add comment