This post is in part 2 of the series in XML, HTML and QTP. For part 1, please refer XML and QTP Part1.In part 1 we discussed about the basics of XML, HTML and differences between them.
Broadly speaking, with QTP, XML can be used in two ways:
As an XML checkpoint. – This is the topic for today’s post OR User-defined external environment variables. – This will be covered in the next post.
For all the examples in this post, we will use http://www.w3schools.com/XML/simple.xml
XML checkpoints are further classified into 3 types:
1. XML Web Page/Frame Checkpoint. Checks an XML document within a Web page or frame.
2. XML File Checkpoint. Checks a specified XML file.
3. XML Test Object Checkpoint. Checks the XML data for an object or operation
So how can we insert an XML Checkpoint?
Simple start recording. Insert > XML Checkpoint(From Application- In case of Web Page checkpoint) OR XML Checkpoint (From Resource – In case of File/Test object Checkpoint) and point the ‘hand’ on your application, in our case on http://www.w3schools.com/XML/simple.xml. You will get something like this:
Click on the button (as shown above) to parameterize the values of corresponding elements.
Here are some of the common uses of XML checkpoint:
1) It can be used to verify data changes across builds.
2) It can be used to verify whether the structure(hierarchy) of the XML file matches to with the schema. Change of structure of an XML file can lead to problems in processing XML file.
Some points to note about XML checkpoints:
3) The only difference between XML Web Page/Frame Checkpoint and XML File Checkpoint is that the former can be done only during recording and can be done on an LIVE application while in the case of latter, checkpoint can be inserted from the files residing on your hard disk.
4) In the case of XML Test Object checkpoint, a drop down named “Method Name” comes up, if you select a WebServiceTest Object (as shown in the image)
5) You can also use relative paths while ‘browsing’ for a file using XML File checkpoints.
6) You can’t insert an XML checkpoint from Active screen
There is much more to XML then that we have discussed yet. In future posts, I intend to cover the advanced topics on XML.