Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

how to check response field is sorted asc or desc

Options
Neil
Neil Posts: 38
edited December 2016 in SOAtest

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

  • Ramiro Martinez
    Ramiro Martinez Posts: 53 admin
    Options

    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

  • Neil
    Neil Posts: 38
    Options

    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.