Im still lost. 
Maybe because I dont understand why anyone would want that?
With persistance, you can create variables (environment & globals) via runner, that you can then later use in Builder mode?
Perhaps it helps if I explain what I want to achieve. 
It is similar to a different post I saw around here, but maybe not quite it.
As app developer, I dont have control over my API’s, but I did put them all in one collection and then per category in a folder. But there are also requests that I dont want to fire in a runner.
So I decided to create a Pre-request piece of code, that creates an Array of Requests that I want to execute. Then I wrapped them in an IF Statement, so that it should only run this piece of code, when in Runner mode. And not in Builder mode.
Pre-request
{code}
// Below we have configuration to create our own flow of requests.
console.log(“^^^ BEFORE | IF in pre-request of Collection! ^^^”);
console.log(pm.info.requestName);
var runnerVar = pm.globals.get(“runnerVar”);
console.log(“This value: “+runnerVar);
if (runnerVar === true ){
console.log(”_____ IN IF in pre-request of Collection! ______”);
console.log(pm.globals.get(“runnerVar”));
var ArrayOfRequests = pm.globals.get("ArrayOfRequests");
if (!ArrayOfRequests) {
var ArrayOfRequests = ["req1","Re2","Req3","Req4"];
pm.globals.set("ArrayOfRequests", ArrayOfRequests);
}
console.log("_____ ENDOF IF in pre-request of Collection! ______");
}
console.log(pm.globals.get(“ArrayOfRequests”));
console.log(“^^^ AFTER | IF/ELSE in pre-request of Collection! ^^^”);
{code}
So then I fire the actual requests. In my data file I actually have only this, because I just want to set the value to true, that we are in the runner mode.
{code} [{
“runnerVar”: true
}]
{code}
Then in the Test tab, on the collection level, I have this:
{code}
if (pm.globals.get(“runnerVar”) === true) {
var ArrayOfRequests = pm.globals.get(“ArrayOfRequests”);
var nextRequestOfArray = ArrayOfRequests.shift();
//pm.globals.set(“setNextRequestFlow”, nextRequestOfArray);
var arrayLength = parseInt(ArrayOfRequests.length);
console.log(arrayLength);
console.log(ArrayOfRequests);
console.log("<><><><> START THE IF in Collection level Tests <><><><>");
if (arrayLength > 0) {
postman.setNextRequest(nextRequestOfArray);
console.log("<><><><> IF in Collection level Tests <><><><>");
console.log(nextRequestOfArray);
} else if ((nextRequestOfArray !== null) && (arrayLength === 0)) {
//} else if (arrayLength === 0) {
console.log("<><><><> ELSE in Collection level Tests 1 <><><><>");
postman.setNextRequest(nextRequestOfArray);
console.log(nextRequestOfArray);
} else if (arrayLength < 0) {
postman.setNextRequest(null);
pm.globals.set("runnerVar", false);
console.log("<><><><> ELSE in Collection level Tests 2 <><><><>");
}
console.log("!!!!!! WE DONE !!!!!!");
}
{code}
There is something that Im missing here.
But I want to select very specifically which requests should be run in the Runner, and not randomly everything. Plus I dont want to have this logic, fixed in each request it self. Because that is to me to low level. And not maintainable.
Plus if I have this working, I can set different Test scenarios in an Array to execute (comprised of multiple requests).
And when executing those, we could run several build jobs in i.e. Jenkins, to see if one of the Backend API’s is failing.
@shamasis << You must have some ideas too
