For a XML response, how can i do a data type assertion validation?
I have started using xml assertions for the response validation. I am looking for sharp answer than generic ones saying try assertions from output.
1) I want to validate data type for the response. ( String or int or text etc)
2) I need to do data length validation
3) i need to validate actual response to the expected value response
Can you please give me the assertion type and steps to be used in this scenario? Thank you Benken in advance.
Here's some useful resources
Official docs have some good information including a short video tutorial, see https://docs.parasoft.com/display/SOAVIRT20222/XML+Assertor
Also, it's likely your questions has already been asked/answered before, so searching the forum is handy to find answers quickly.
For the length of the data length validation see:
As an example I have an element in my xml called TITLE and the value is shown below:
One way to do this is to add an xml assertor (add Value Assertion) to the response and edit the XPath (Selected Element) manually to check the string length, e.g.:
Then set the expected value accordingly. In the above example I expect the value to be 16 characters long, so I set the Expected Value to be Fixed=16. You can also add a String Comparison Assertion and check the value. I select the element from the tree (/CATALOG/CD/TITLE/string()) and set the expected value to be Fixed=Empire Burlesque.0
Thank you Powell. This will help me. i will check it out and let you know if i face any problems. Thank you again for your detailed response.0