Forum Discussion

joakim_schweize's avatar
New Contributor
15 years ago

Expected result in XML comparison


I'm currently trying to verify some information returned by a WebService against an XML document in test complete, but the call to the WebService returns a lot more information then I am interested in, or able to verify.

The call I am sending with the Call Object Method looks like this (simplified):




Which would return something like this:






            <companyName>Test Account</companyName>

            <contactPerson>Firstname Lastname</contactPerson>




etc etc etc...

The point is, the lastLogin value is not one I can set to something expected in the XML file because it will change automatically, so in the XML comparison, I would like for TC to ignore this value, and just compare the other ones to the expected XML.

How can I set a value to be ignored in the XML comparison?




5 Replies

  • Hello Joakim,

    You need to delete the lastLogin node of the corresponding XMLCheckpoint element and enable the "Compare in subtree mode" option for the element. Please see the "XMLCheckpoint Element Editor" article for details.

  • Hi Allen

    Very nice, that did the trick. Thanks alot =)

    Since that one was too easy for you, here is another one;

    When using the Web Comparison Checkpoint, TC compares a stored HTML document to the HTML output from the defined webpage (defined by object).

    My problem is that the web page I am running the comparison against contains a PRADO_PAGESTATE tag that is unique for each session.

    So; is there a way to get TC to ignore a given tag when comparing the HTML?

    Tag looks like this;

    <INPUT id=PRADO_PAGESTATE value=gh53nX4reLK01Q== type=hidden name=PRADO_PAGESTATE>

    What I am trying to do is that before the actual test commences, I want to verify that the existing data in the form on the web page is correct, and instead of making 14 different property checkpoints to check each individual input field in the form, I have just been using the Web Comparison Checkpoint to check them all at once.

    Because I only want to check the values of the textfields and checkboxes the stored HTML is set to compare INPUT values only.

    Hope this is equally simple to fix as the XML comparison.



  • Hello Joakim,

    Unfortunately, there is no way to ignore a certain INPUT tag in the Web Comparison checkpoint. However, you can use the XML checkpoint instead of the Web Comparison checkpoint to accomplish your task.

  • Hi Allen

    Thanks for your reply.

    I have been trying to figure out how one can use the XML comparison checkpoint to compare webpages as you said should be possible, and so what I have does is that I first copied all the HTML source data from the Web Testing comparison file into an XML comparison file.

    I then setup the XML comparison checkpoint to compare this XML file (now containing HTML) with the live webpage I am trying to compare it too (by pointing to the webpage object the same object as the Web Comparison checkpoint pointed to when I was trying to use that), but when I run the checkpoint the log returns: "Unable to load data. Please specify a URL or an IXMLDOMDocument object."

    If I try to setup the XML checkpoint to compare the stored XML file (now containing HTML) to the URL of the page I am trying to compare it too, I get: "The 'https://webpage/example' document is invalid. Error: System error: -2146697208.".

    Sorry, but I'm gonna need a little more help to understand how I can use the XML comparison checkpoint for my purpose.



  • Hello Joakim,

    The error occurs because the XML checkpoint's component cannot download your page from the encrypted web site. I suggest that you save the page's source to a local file and check it using the XML checkpoint in your test.

    BTW, you can create your custom checkpoint that perfoms necessary checks on your pages using TestComplete's Script Extensions feature. Please see the "Script Extensions" article on our Support Portal.