Unplanned
Last Updated: 26 Sep 2017 11:30 by ADMIN
Rafal
Created on: 21 Dec 2016 16:17
Type: Feature Request
3
Validation: Size of array and null check
When validating JSON files by path, it would be good to check the size of an array or if an object is null or not based on JSON path.

First one, size of array, can be implemented with .hasSize(int n) attribute from JsonPath.

Second one, check whether an object is null, can be implemented within doesNotExists() method.

For my scenario, I have a request that contains N elements and response that should contain <= N responses. I would like to check if response array is not null and if it contains X elements based on request count.
5 comments
ADMIN
Oleg
Posted on: 26 Sep 2017 11:30
Hi,
Since version R2 2017 (v. 2017.2.530) from May 30, 2017  coded steps (see http://docs.telerik.com/teststudio-apis/features/code-features/coded-steps ) can be used to validate size of array and null variables.
ADMIN
John
Posted on: 16 Jan 2017 15:12
Hi Michel,

Thank you for the suggestion. We are planning to add script/coded steps to Test Studio for APIs in the near future. This is why at least for now we intend to leave this scenario and other complicated use cases to be handled using script/coded steps. We expect that this will be usable enough. Please stay tuned to our future releases. Once we manage to deliver the feature, we will be happy to hear your further feedback if we have managed to cover your use case.

Best Regards,
Ivan Atanasov
Michel
Posted on: 15 Jan 2017 08:11
Will it be possible to implement the counter function for an array?

{
    "numbers": [1,2,3,4,5]
}

with $.numbers.Count ?

Thank you Ivan
ADMIN
John
Posted on: 03 Jan 2017 14:33
Hi Rafal,

Currently the product uses JSon.NET http://www.newtonsoft.com/json/help/html/SelectToken.htm which does not support all features of JSON Path of http://goessner.net/articles/JsonPath/index.html#e2. 

We are considering adding script/coded steps for more complicated scenarios of verifications and variable extractions.

Best Regards,
Ivan Atanasov
Michel
Posted on: 25 Dec 2016 07:31
Hello, i need to check if attribA/B or valueA/B exists or not on my JSON return :

{
attribA : valueA
attribB : valueB
}
It will be beautifull if you add that..