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 validate non-numeric field is ASC or DESC?

Neil Posts: 38

Hi All,

type: REST API, method: GET
1)My JSON response contains list of documents, In which I have filename field (non-numeric).
I can send a parameter in request to get all the documents sorted ASC or DESC on filename.
I want to read the filename in response and check the order is ASC or DESC.

2) same way I also want to apply the same ASC and DESC logic on date field.

Thanks in advance.



  • paulh
    paulh Posts: 1

    It is often best to prepare your test data in your test setup so that you know exactly what documents will be returned. In this way, your tests are built on concrete examples, rather then re-implementations of rules.

    Doing this allows you to test that specific document names and dates occur in the expected positions in your json result array.

    This also eliminates the risk that the sorting logic in your application is not the same as the sorting logic in SOAtest. For example, your application may sort "test1.txt" before "test11.txt", but SOAtest doesn't. Reimplementing sorting logic is tricky and an example of connasence of algorithm which is generally undesirable.