Having an issue with this test. I am trying to trigger a console.log
when the installment value in my JSON is less than 100 (resulting in a test FAIL
). However, I am receiving both PASS
and FAIL
results in the test, but no information is showing up in the console.log
. I'm unsure why my code isn't functioning as expected. I believed using else if
would provide the desired outcome, but it seems there are still issues.
var jsonData = JSON.parse(responseBody)
for (var i = 0; i < jsonData.length; i++) {
for(var j = 0; j < jsonData[i].products.length; j++) {
pm.test("Installment Check", function() {
if (pm.expect(jsonData[i].products[j].installment).to.be.above(100))
{
// Successful case...
}
else if (pm.expect(jsonData[i].products[j].installment).to.be.below(100))
{
// Failure case...
console.log(jsonData[i].id)
}
});
}
}