How to validate non-numeric field is ASC or DESC?
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.
regards,
Neil
Comments
-
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.
0