Hello everyone,
I am new to postman and trying to run a test by using if-else conditional flow. But in my test the else part is not being read.
If the if assertion is false then the test stops without moving to else.
Please help me with this.
Below is my code - Here I have a key โmodeโ in my request body and I need to assert the test based on the value for that:
if (pm.expect(JSON.parse(pm.request.body.raw).mode).not.eql("sms"))
{
pm.test("Status code is 400", function () {
pm.response.to.have.status(400);
});
}
else
{
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
}