how to check response field is sorted asc or desc
Hi All,
type: REST API, method: GET
My JSON response contains list of documents, In which I have file size field. I can send a parameter in request to get all the documents sorted ASC or DESC on filesize.
I want to read the file size in response and check the order is ASC or DESC.
Thanks in advance.
regards,
Neil
Comments
-
Hi Neil,
Have you tried the XML/JSON assertor with a numeric assertion?
The numeric assertion has the options '<', '>', and other comparison options.For your use case, I suggest data banking the values you need to compare and then calling them in the XML assertor.
Due to visibility restraints you will need to call the variables manually using:
${name_of_variable}.
I suggest changing the variable to make it easier to call the values.Short example below:
Best regards,
Ramiro Martinez
1 -
Thank you so much Ramiro Martinez ,I think this logic will help. I will try this.
but I also have to validate other sorting.The solution you gave works for numeric.
1) How about if we have to validate filename field is ASC or DESC?
2) How to validate if date is ASC or DESC order?any thoughts? please let me know.
Thanks again.
0