XML File handling Using QTP

QTP Descriptive programming with xml file handling

The following example uses the ItemByName property to confirm that the QTP attribute was added.

Set doc = XMLUtil.CreateXML()

doc.LoadFile "c:\example.xml"

Set root = doc.GetRootElement()

Set attrs = root.Attributes()

msg = "At first I had " & attrs.Count() & " attributes. "

root.AddAttribute "QTP","Great"

Set attr = attrs.ItemByName("QTP")

if attr is nothing then

msgbox "Failed to add attribute!!!"

end if

msg = msg + "Now I have " & attrs.Count() & " attributes. "

root.RemoveAttribute "QTP"

msg = msg + "Again I have " & attrs.Count() & " attributes."

msgbox msg

For gaining more insights in the automation using QTP log on to below url :

Automation Testing Using QTP


  1. In My Test I have 100 check points, How can I know the status/result of each check point in the test at run time. I want to print that stats in Excel sheet.

    ( I know we get the result of the check point can be known from the result viewer, but it is not used from my scenario).
    Another is :

    If Browser("Order List").Page("Home Page").Check(CheckPoint("Home Page")) = "Pass" Then
    Msgbox "pass"
    MsgBox "Fail"
    End If

    "this also not suitable for me.

    Plz give the Best solution for me.

    1. Hi Uday,
      Did you try using the output parameter concept within the checkpoint properties.Utilising the checkpoint properties you can save this output parameters into an output data file or the same test result log. I hope this answers your request.