Value or xml assertion on response message containing escaped XML
Hello,
I am testing a web service where the response looks like the following:
Within the element XMLOutput is well-formed XML in escaped character format. I would like to do XML Assertion on the escaped XML, but I am unable to because XPATH does not work on escaped XML.
The question is: how can I perform XML assertion on XML in escaped format in the response?
Best Answer
-
Hi trand2,
Your query is quite possible within SOAtest.
To achieve this, you will have to use a series of chained tools to first extract and then perform an assertion on that value. The first tool you will want to chain to your response body is an XML Transformer. When you chain the Transformer, run the client again to populate the text box in the transformer tool. It should look something like this:
Once that has been done, switch to the "Tree" tab under the tool settings dropdown where the large text box is located. Here, double click on the ParentElement element. You may notice that there is a child element here under ParentElement with an italicized 'e'. This is to show that there is an escaped element here that SOAtest was able to parse.
After double clicking on the ParentElement, double click on the element in the Selected Element view to the right. This will open up a dialogue box with some settings on the element that we are grabbing. Here, click the dropdown menu where it says Extract Entire Element and choose Content Only.
Click OK, and save the XML Transformer. We will then add the XML Assertor as an output to the Transformer, and then click on the Configuration tab. Then, rerun your client to populate the expected xml for this tool.
Add the assertion you wish to perform, and you will see that the encoded XML that you want to assert on has been decoded.
Please let me know if any of the steps were unclear, or if this helps!
-Thomas
5