1) Print the selected environment on console
2) if else condition to execute a particular test based on the environment.
console.info(pm.environment.name);
pm.environment.set("currentEnvName",pm.environment.name); var environementName = pm.environment.get("currentEnvName"); console.log("Environement Name Current Used Is : "+environementName); if(pm.environment.name=="Server1" || pm.environment.name=="Server2" ||pm.environment.name=="Server3"||pm.environment.name=="Server4" ){ postman.setNextRequest(null); } else { postman.setNextRequest("TestCase123"); }
https://stackoverflow.com/questions/58612238/postman-get-the-environment-name-as-a-variable
No comments:
Post a Comment