You can use the Description object to return a Properties collection object containing a set of Property objects. A Property object consists of a property name and value. You can then specify the returned Properties collection in place of an object name in a statement. (Each property object contains a property name and value pair.)
Note: By default, the value of all Property objects added to a Properties collection are treated as regular expressions. Therefore, if you want to enter a value that contains a special regular expression character (such as *, ?, +), use the \ (backslash) character to instruct QuickTest to treat the special characters as literal characters.
To create the Properties collection, you enter a Description.Create statement using the following syntax:
Set MyDescription = Description.Create()
Once you have created a Properties object (such as MyDescription in the example above), you can enter statements to add, edit, remove, and retrieve properties and values to or from the Properties object during the run session. This enables you to determine which, and how many properties to include in the object description in a dynamic way during the run session.
After you fill the Properties collection with a set of Property objects (properties and values), you can specify the Properties object in place of an object name in a test statement.
For example, instead of entering:
you can enter:
Set MyDescription =
MyDescription("text").Value = "OK"
MyDescription("width").Value = 50
Note: When using programmatic descriptions from a specific point within a test object hierarchy, you must continue to use programmatic descriptions from that point onward within the same statement. If you specify a test object by its object repository name after other objects in the hierarchy have been described using programmatic descriptions, QuickTest cannot identify the object.
For example, you can use Browser(Desc1).Page(Desc1).Link(desc3), since it uses programmatic descriptions throughout the entire test object hierarchy.
You can also use Browser("Index").Page(Desc1).Link(desc3), since it uses programmatic descriptions from a certain point in the description (starting from the Page object description).
When working with Properties objects, you can use variable names for the properties or values to generate the object description based on properties and values you retrieve during a run session.
You can create several Properties objects in your test if you want to use programmatic descriptions for several objects.
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/16792402/viewspace-567243/，如需转载，请注明出处，否则将追究法律责任。