lundi 25 février 2019

Postman Tests - Conditioning with http status

I want to check if an answer is ok. It is either correct when the response code is 200 or 500. Latter needs to differentiate between a String in the response body to be correct or incorrect. It should be in a single test.

I already tried simple if-clauses, but they do not work.

pm.test("response is ok", function(){
    if(pm.response.to.have.status(200)){
        //do things
    }     
});

Aucun commentaire:

Enregistrer un commentaire