Conditional WorkFlow in Postman : API Testing using Postman
HTML-код
- Опубликовано: 3 фев 2025
- Conditional Workflow in Postman means that Sequence of the request - If this happen then this happen else this happen is workflow.
Specify the name of the subsequent request.
postman.setNextRequest(“Request Name”);
To terminates execution.
postman.setNextRequest(null);
Join Facebook Group : bit.ly/learntes...
Website: scrolltest.com
Website: thetestingacad...
Twitter: / itstechmode
Buy the Full course Here - ►► www.udemy.com/... ◄◄I
Buy the Full course Indians - ►► bit.ly/apitesti... ◄◄
setNextRequest() is always executed at the end of the current script.
This means that if you put setNextRequest() before other code blocks, these blocks will still be executed.
setNextRequest() has a scope, which is the source of your collection run. This means that if you run a collection, you can jump to any request in the collection (even requests inside folders, using the same syntax). However, if you run a folder, the scope of setNextRequest() is limited to that folder. This means that you can jump to any request within this folder, but not ones that are outside of the folder.
🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌
✅Selenium Training and Certification -
scrolltest.com...
✅Learn Jenkins for QA -
bit.ly/learnje...
✅Programming Java -
bit.ly/learnja...
✅Test Automation -
bit.ly/learnau...
✅API Testing -
www.learnapite...
✅Cypress Tutorial with LIVE Projects -
cypresstutorial...
Very helpful. Thank You!!
Glad it was helpful!
Awesome job! Very well explained.
Hi, is it possible to run an if statement in the Body of postman? If name != null use it...
Hi I need for clarity on this topic with more example
what to write in tests, in java script or something else ? I cant find the video where you have told about the syntax on how to write (pm. ), how to write in that syntax and how to validate the id first name last name etc by writing in this way. Please share the links......
Check the latest Postman Advance video, i have explained pm object thoroughly
Hi. I have a question. I have 2 post requests. Now, i have written pre request script and test such that 1st post request will execute one time and it will go to 2nd post request. When 2nd post request execute, it will again go to 1st request. After 5 iterations, 2nd post request should stop the test. Now my concern is that i am not able to stop the script after 5th iteration. Can you give one example for this? i have used if and else condition. I dont know where to put next request as null
You need to use logic with condition
easily understandable, thanks :)
Great video, I have a questions. I am using the csv file and suppose I have 10 rows but one row might have null and I want to skip it and move to the next row. how can approach that. I have tried something like this but it didn't work
var resourcetype = pm.iterationData.get("resource_type")
if(resourcetype === null) {
postman.setNextRequest(null); }
I would suggest to sanitise the CSV file first
Hi, Parmod its very good.thanks.font is very low plz increase so that we easly seen.
Sir i have a question i have 10 parameters and in first test script i write for positive scenario in which all the parameter will run and register successfully
After that 9 more test cases in which one parameter is null respectively ...but in pre request script has more no of lines ...i have use switch case in test script
Plz rply sir its urgent
let swicthCaseIteration= +pm.environment.get("swicthCaseIteration");
switch(swicthCaseIteration) {
case 0:
pm.environment.set("userMobileNumber", +pm.environment.get("userMobileNumber")+1);
pm.environment.set("i", +pm.environment.get("i")+1);
//pm.environment.set("userName", +pm.environment.get("userName")+1);
pm.variables.set("addressOne", "delhi");
pm.variables.set("addressTwo", "varansi");
pm.variables.set("cityCode", "IN-BR-DH");
pm.variables.set("countryCode", "IN");
pm.variables.set("domainId", 75);
pm.variables.set("emailId", "emailId3{{i}}@gmail.com");
pm.variables.set("firstName", "automate");
pm.variables.set("lastName", "string");
pm.variables.set("mobileCode", "+91");
pm.variables.set("mobileNumber","{{userMobileNumber}}");
pm.variables.set("orgId", 170);
pm.variables.set("roleId", 4);
pm.variables.set("stateCode", "IN-BR");
pm.variables.set("userName", "automation98{{i}}");
pm.variables.set("zipCode", "656689");break;
case 1:
pm.variables.set("addressOne", "");
pm.variables.set("addressTwo", "varansi");
pm.variables.set("cityCode", "IN-BR-DH");
pm.variables.set("countryCode", "IN");
pm.variables.set("domainId", 75);
pm.variables.set("emailId", "emailId3Negativee{{i}}@gmail.com");
pm.variables.set("firstName", "automate");
pm.variables.set("lastName", "string");
pm.variables.set("mobileCode", "+91");
pm.variables.set("mobileNumber","5678907898");
pm.variables.set("orgId", 170);
pm.variables.set("roleId", 4);
pm.variables.set("stateCode", "IN-BR");
pm.variables.set("userName", "automation98Negativee{{i}}");
pm.variables.set("zipCode", "656689");break;
case 2:
I have wrriten like this more 10 cases in pre request and it is of 300 lines how can i reduce this
Create a Javascript object and set in values in Switch (rather all values in env)
@@TheTestingAcademy sir i have created object for positive test cases
i need this code..flow i understand but not able to seen the code,plz reply as soon as possible
Sorry to say but really didn't understand at all what was really explained. Please be very slow
intro so flashy, give me shaking, dis.
Haha, you got this....