Hey, so I’m not exactly sure what’s the issue here yet. Excuse the bad code.
So I have tried to create an array with 2 values that would be randomly picked.
var activeTF = ["true", "false"];
postman.setEnvironmentVariable('index', 0);
let randomActive = (_.random(0,1));
pm.globals.set("randomActive", randomActive);
var index = parseInt(postman.getEnvironmentVariable('index'));
index = index + randomActive;
let aTF = activeTF[index];
And now I’m trying to test whether the response body has the correct value:
pm.test("Approved Status is Correct" , function(){ pm.expect(pm.response.json().approved).equal((pm.environment.get(
appTF))) }); pm.test("VIP Status is Correct" , function(){ pm.expect(pm.response.json().vip).include((pm.environment.get(
vTF))) });
Above I’ve tried both with include and equal but both fail, the first one I think the value is dashed when compared. Second one pm won’t recognise the array.