Hi,
I am getting error “ReferenceError: BasketID is not defined”. I have created a Global Variable call “BasketID”. and during my test I am storing value from response against the variable.
After running script I can see the Global Variable is showing value, but in console I get the error. I am new to Postman and struggling to figure this out.
Thanks in advance…
=== Script=== Post Response ====
const response = pm.response.json();
const basketid = response[“basketId”];
pm.globals.set(“BasketID”,basketid);
console.log(BasketID);
pm.test("Basket Id is create ", function (){
pm.expect(pm.response[“basketId”]).to.not.be.null;
});
pm.test(“Successful POST request”, function () {
pm.expect(pm.response.code).to.be.oneOf([200,400]);
});