Quantcast
Channel: Pochampalli IT Labs
Viewing all articles
Browse latest Browse all 261

Print the environment name on console and based on environment selection write if else condition to execute a particular test in newman/postman

$
0
0
Hi, 

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");
}

References:
https://stackoverflow.com/questions/58612238/postman-get-the-environment-name-as-a-variable

Viewing all articles
Browse latest Browse all 261

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>