Json file validation
I have json file and i want to validate if some column like bank and corresponding value abc is not available in the file.
Can any one suggest me how to do that
Answers
-
For example, let's say your JSON contains an array with "column" and "value" like what you mention:
[ { "column" : "bank", "value" : "abc" }, { "column" : "school", "value" : "123" } ]
In SOAtest, you can configure a JSON Assertor tool to take this as Input. The tool can accept Input from another test or can reference an external file. One way to accomplish this type of validation would be to create an "Occurrence Assertion". You can first create the assertion on any element you like (doesn't matter). After the assertion is created, click the "Change Element" button, select "Edit XPath manually", then change the XPath to something like "/root/item[column="bank" and value ="abc"]". In the occurrence assertion you can set "Occurrences of element" to 0 if you want to make sure an array item with column="bank" and value ="abc" does not exist.
0 -
I tried with above path you mentioned but seems not working..its not allowing me to enter xpath in that way
0 -
@benken_parasoft can you help me with above query? I am getting error for the path you suggested
0 -
The XPath you need depends on the structure of the message in question. I was only giving you an example.
0