How UFT applies the test object model concept

Relevant for: GUI tests and components

The test object model is a large set of object types or classes that UFT uses to represent the objects in your application. Each test object class has a list of description properties that UFT can learn about the object, a sub-set of these properties that can uniquely identify objects of that class, and a set of relevant operations that UFT can perform on the object.

A test object is an object that UFT creates in a test or component to represent the actual object in your application. UFT stores information on the object that will help it identify and check the object during the run session.

A run-time object is the actual object in your application on which methods are performed during the run session.

When UFT learns an object in your application, it adds the corresponding test object to an object repository, which is a storehouse for objects. You can add test objects to an object repository in several ways. For example, you can use the Navigate and Learn option, add test objects manually, or perform an operation on your application while recording. For details, see Test Objects in Object Repositories.

When you add an object to an object repository, UFT:

  • Identifies the UFT test object class that represents the learned object and creates the appropriate test object.

  • Reads the current value of the object's properties in your application and stores the list of description properties and values with the test object.

  • Chooses a unique name for the test object, generally using the value of one of its prominent properties.

Example: Suppose you add a Search button with the following HTML source code:

<INPUT TYPE="submit" NAME="Search" VALUE="Search">

UFT identifies the object as a WebButton test object. In the object repository, UFT creates a WebButton object with the name Search, learns a set of description properties for the object, and decides to use the following properties and values to uniquely identify the Search WebButton:

If you add an object to an object repository by recording on your application, UFT records the operation that you performed on the object using the appropriate UFT test object method.

For example, UFT records that you performed a Click method on the WebButton.

In an action: UFT displays your step in the Keyword View like this:

In a component: The hierarchy is not displayed, and the step is displayed like this:

In the example above, the action is displayed in the Editor like this:

Browser("Search Results: Search").Page("Search Results: Search").WebButton("Search").Click

When you run a test or component, UFT identifies each object in your application by its test object class and its description (the set of description properties and values used to uniquely identify the object).

The list of test objects and their properties and values are stored in the object repository.

In the above example, UFT would search in the object repository during the run session for the WebButton object with the name Search to look up its description.

Based on the description it finds, UFT would then look for a WebButton object in the application with the HTML tag INPUT, of type submit, with the value Search. When it finds the object, it performs the Click method on it.

See also: