How do I get to TORepository collection at runtime
I'm pretty new to QTP. I've had some training classes so I know the basics of using the tool and scripting. I'm a trained programmer, so I know how to write code in general.
What I'm trying to find is a way to access the Test Object Repository collection at run time to get a collection of the child objects of a particular object. Then I want to interate through that collection and see if all the objects still exist in the Run Time object.
Here's a simple scenario.
Say I have a Window ("WindowMain") that has three user entry text fields ("Input1", "Input2", "Input3") and three buttons ("Save", "Cancel", "Options"). When the user clicks Save the data is "saved" with no change to the screen. When the user clicks "Cancel" the input fields are cleared. When the user clicks "Options" a new window opens.
I've created a Test Object repository that has all these objects in it.
At run time I want to access the Test Object repository and get all the first generation child objects of WindowMain. That would give me a collection that contains the 3 text input fields and the 3 buttons.
Then I want to iterate through this collection and use the Exists method on each item to see if it exists in the Run Time object. This would tell me if any of the expected objects went missing since the last build.
On the flip side at run time I know I can use the ChildObjects method on the Window("WindowMain") to get a collection of all the child objects of the Run Time WindowMain object. If I could compare that collection to the Test Object repository collection I could find out if an object was added to the run time since the last build.
Any pointers or suggestions are welcome. Thanks!
(Opinions and information contained in this post are wholly my own and do not reflect the opinions of my employer.)