clay
8 years agoContributor
How to verify the absence of an element in an XML checkpoint.
I have an application that is supposed to remove an element from an XML document. So I want the checkpoint to pass if the tag is missing and fail if the tag is present. How does one go about doing ...
- 8 years ago
I personally would not use a checkpoint. I'd actually create an instance of the MSXML.DOMDocument object and use it to search for the tag. If the tag comes back, then it fails. Specifically, I'd use the "selectNodes" method (https://msdn.microsoft.com/en-us/library/ms754523(v=vs.85).aspx).
If you want do to checkpoints, basically, within your project, under the "Stores" section, add the XML node and then add an XML checkpoint for your XML Document. Basically, make it to match the expected (i.e., missing the tag) and then use the "Check" method on that object to see if the tag is missing. If it's there, the checkpoint should fail.