How can I test if key gender
is either 1 or 2, please?
"naturalPerson": {
"fullName": "Teste with Luis",
"nickName": "Pacheco",
"gender": 2,
"pronoun": 2,
How can I test if key gender
is either 1 or 2, please?
"naturalPerson": {
"fullName": "Teste with Luis",
"nickName": "Pacheco",
"gender": 2,
"pronoun": 2,
Assuming your response looks like this:
{
"naturalPerson": {
"fullName": "Teste with Luis",
"nickName": "Pacheco",
"gender": 2,
"pronoun": 2
}
}
Then to check the βvalue is 1 or 2β you could use the following
const response = pm.response.json();
pm.test("Check value is either 1 or 2", function () {
pm.expect(response.naturalPerson.gender).to.be.oneOf([1, 2]);
});
Your are the best!!.. Thank you x 1000β¦
Be happy
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.