mardi 28 novembre 2017

Postman Tests: Assert several possible response status

When testing in Postman, you can use pm.response.to.have.status(200) to assert that the response status should be 200.

Is there any simple way to assert multiple statuses? I tried pm.response.to.have.status(200||404) and it didn't work.

I'm looking at the Postman Sandbox API Reference and there doesn't seem to be a straightforward solution for this, although maybe something can be worked out.

Since it's rather bizarre, I'll explain why I want this: it's a DELETE request that will standardize the database for later requests and I don't care which is returned as long as it's either.

Aucun commentaire:

Enregistrer un commentaire