How can we validate and test in Tests, that in the response array
First Customer Number as sent in the request.
Second verificationNumber and verification status is String and has some value
Third verificationDate with type date-only is today’s date in DD/MM/YYYY format
I have tried below
var x= pm.response.json();
pm.test('Test Verification number is a string ’ ,function(){
Also how can we test the value is oneOf the string
Like for example in above if Verification status can take 5 values (Pass, Fail, No result, Error, On hold), how can we ensure value is one of them.
Hello @bpricilla
Thanks for the reply.
I have tried pm.expect(jsonData.deleates[i].refusal.code).to.be.oneOf([“1306”, “502”]);, but it doesn’t work for string value, works for number, unless I am doing something wrong
Got is @bpricilla .Thank you so much,
Silly me. works now Thank you so much.
Can you please also help with the validating response is string and has some value.
I mean I was able to get it is a string from below
pm.expect(x.customers[0].verificationNumber).to.be.a(‘string’) , how can validate it contains a value as well?
Thanks
Since I don’t have the full response of yours I suggest you to read through this post which I have mentioned above. You can tweak this based on your needs.
Thanks @bpricilla for your kind help.
I have gone through post. I have tried and gone through the post, I am unable to figure out at this stage
I need some help on below scenarios if you can help please. Below is my response
I need to first check if iDNumber in response matches to Id number sent in request.
Once it matches, then check
Id type matches what is sent in request
text is either “Check passed” or “Check failed”
status is “Pass” or “Fail”