QTP Object Repository : How to Retreive Child Values from Object Repository of a Parent Object and display Child Objects in Excel.

Public Function FetchAllChildProperties(Root)
'The following function recursively enumerates all the test objects directly under
'a specified parent object. For each test object, the Value is displayed on the excel Sheet.I have commented 'the Message Box , you can uncomment this but i use excel for displaying the value.

    Dim TOCollection, TestObject, PropertiesCollection, Property, Msg

    Set TOCollection = RepositoryFrom.GetChildren(Root)

    For i = 0 To TOCollection.Count - 1
   

            Set TestObject = TOCollection.Item(i)
            component_name = RepositoryFrom.GetLogicalName(TestObject) & vbNewLine
           
            start_row = Application.WorksheetFunction.CountA(Range("A:A"))
           
            Cells(start_row + 1, 1).Value = component_name
           
            Set PropertiesCollection = TestObject.GetTOProperties()

            For n = 0 To PropertiesCollection.Count - 1
           
               
                Set Property = PropertiesCollection.Item(n)
                Cells(start_row + 1, n + 3).Value = Property.Name
                Cells(start_row + 1, n + 4).Value = Property.Value
                'Msg = Msg & Property.Name & "-" & Property.Value & vbNewLine
           
            'Cells(i + 1, 2).Value = Msg
            Next
           ' MsgBox Msg
'i = i + 1

        EnumerateAllChildProperties TestObject

Next

End Function

4 comments:

  1. Thanks for your informative article on UFT automation testing tool. Your post helped me to understand the features and functionality of QTP automation testing tool. QTP training in Chennai

    ReplyDelete
  2. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  3. Object repository is a collection of object program and priorities with QTP is will be able to recognize UFT object act it.The user record to the test objective properties it will understand the QTP Scripting properties.Selenium Training in Chennai
    Selenium Automation Testing Training in Chennai

    ReplyDelete