I have a problem with this test. I want get a consol.log
when the installment value in my JSON is below 100(when test FAIL
). But as result, I have a PASS
and FAIL
in test results, that’s work but I can’t get any info in consol.log
. I don’t know why my code doesn’t work. I thought else if
give me the expected result. But still, it doesn’t work well.
Test script
var jsonData = JSON.parse(responseBody)
for(var i=0 ; i<=jsonData.length - 1; i++){{
for(var j=0 ; j<=jsonData[i].products.length - 1; j++)
pm.test("Installment > 100", function(){
if (pm.expect(jsonData[i].products[j].installment).to.be.above(100)){}
else if(pm.expect(jsonData[i].products[j].installment).to.be.below(100))
{console.log(jsonData[i].id)}
});
}}
I don’t know if json should be included in this type of question. Is the code enough?
Thanks
Moris