Programmatic descriptions

Relevant for: GUI actions, scripted GUI components, and function libraries

When UFT One learns an object in your application, it adds the appropriate test object to the object repository. After the object exists in the object repository, you can add statements in the Editor to perform additional operations on that object. To add these statements, you usually enter the name (not case sensitive) of each of the objects in the object's hierarchy as the object description, and then add the appropriate operation.

Because each object in the object repository has a unique name, the object name is all you need to specify. During the run session, UFT One finds the object in the object repository based on its name and parent objects, and uses the stored test object description for that test object to identify the object in your application.

However, you can also instruct UFT One to perform operations on objects without referring to the object repository or to the object's name. You provide UFT One with a list of properties and values that UFT One can use to identify the object or objects on which you want to perform an operation or a file containing an image of the control as a description property (for an Insight object).

Such a programmatic description can be very useful in a number of scenarios:

The object is not stored in the object repository Sometimes, your object may not be stored in the object repository, but still needs to be recognized during a test run. In this case, you can use descriptive programming to help UFT One find this object in run-time by describing the object's properties instead of using the object name itself.
A number of objects have common identical properties Normally, when UFT One identifies an object, it uses the description properties for that object to help find the object in the application. In some applications, the application objects have unique description properties. However, in other applications, many objects may have the same description properties, making it much more difficult for UFT One to find the object in the application. In this case, you can substitute the object's properties using a description instead of relying upon the description properties of the object stored in the object repository.
The object is created dynamically during the run session In some applications, you have objects that are created dynamically depending on user input. In applications such as these, it is difficult or impossible to add these to an object repository as they do not "exist" in the application when UFT One is learning it. Therefore, using programmatic descriptions to identify these objects in run time makes it possible for UFT One to find and identify the objects in the application.
The object differs between different versions of the application Especially when working with Web applications, objects have different properties depending on the browser in which the application is displayed. As a result, even if an object is added to the object repository for the application, UFT One may have trouble identifying the object due to how each browser type renders the object. Using descriptive programming instead of static object description properties makes your test objects more flexible in many different situations or browser versions, and enables UFT One to find the object regardless of the environment in which the object is found.

Example:  

Suppose you are testing a Web site that generates a list of potential employers based on biographical information you provide, and offers to send your resume to the employer names you select from the list. You want your test to select all the employers displayed in the list, but when you design your test, you do not know how many check boxes will be displayed on the page, and you cannot, of course, know the exact object description of each check box. In this situation, you can use a programmatic description to instruct UFT One to perform a Set "ON" method for all objects that fit the description: HTML TAG = input, TYPE = check box.

There are two types of programmatic descriptions:

  • Static. You list the set of properties and values that describe the object directly in a VBScript statement. For details, see Static programmatic descriptions.

  • Dynamic. You add a collection of properties and values to a Description object, and then enter the Description object name in the statement. For details, see Dynamic programmatic descriptions .

Using the Static type to enter programmatic descriptions directly into your statements may be easier for basic object description needs. However, in most cases, using the Dynamic type provides more power, efficiency, and flexibility.

In the run results, square brackets around a test object name indicate that the test object was created dynamically during the run session using a programmatic description or the ChildObjects method.