I am getting the following errors: There was an error in evaluating the test script: AssertionError: expected response to have status code 200 but got 409
I thought the following lines would cover that scenario?
if (pm.response.to.have.status(200)){
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
})
} else if (pm.response.to.have.status(409)){
pm.test("Status code is 409", function () {
pm.response.to.have.status(409);
})
}
You’ve used a Postman helper as your conditional check. I think you’re probably trying to do something like this:
if (pm.response.code === 200){
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
})
} else if (pm.response.code === 409){
pm.test("Status code is 409", function () {
pm.response.to.have.status(409);
})
}