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
'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
Thanks!!
ReplyDeleteObject 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
ReplyDeleteSelenium Automation Testing Training in Chennai
I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
ReplyDeletesafety course institute in chennai
She noticed a wide variety of pieces, with the inclusion of what it is like to have an awesome helping style to have the rest without hassle grasp some grueling matters.
ReplyDeleteiosh course in chennai