Manu
Manu

Reputation: 23

How to validate a Response with numbers in Postman

I got the following response - Pre-Note added with PIN (1368)

The PIN number will not be the same always, so, how can I write a re-runnable test to validate it?

Upvotes: 1

Views: 979

Answers (1)

PDHide
PDHide

Reputation: 19979

pm.expect(pm.response.text()).to.match(/<text>Pre-Note added with PIN ([\d]{4})<\/text>/);

you can use chai match method that uses regex , here this rehex will validate the pin is 4digit number

Upvotes: 1

Related Questions