Add test objects to an object repository

Relevant for: GUI tests and components

This topic describes how to add test objects to local or shared object repositories.

Overview

You can add test objects to an object repository in various ways:

  • Use the Navigate and Learn option to add objects to the shared object repository

  • From the Object Repository window for the local repository or the Object Repository Manager for the shared repository.

  • Add test objects to the local object repository while editing your test or component.

  • Use the Object Spy or Object Identification Center (OIC) to spy on objects and add them to the object repository.

  • Record steps to add objects on which you perform an operation to the local object repository. (This occurs for objects that do not already exist in an associated shared object repository.)

  • Use the Capture function to capture objects and add them to the local object repository.

  • Add tests objects from the Active Screen or while inserting steps from the Active Screen.

When you add test objects to an object repository, you can choose to add only a selected test object, to add all test objects of a certain type (such as all button objects), or to add all test objects of a specific class (such as all WebButton objects).

Back to top

Add test objects using Navigate and Learn

Use the Navigate and Learn option to learn test objects and add the learned objects to a shared object repository. For details, see Add test objects using Navigate and Learn.

Back to top

Add objects from the Object Repository window or Object Repository Manager

Add test objects to a local object repository from the Object Repository window or to a shared object repository from the Object Repository Manager.

To add test objects:

  1. Click the Add Objects / Add Objects to Local toolbar button .

    UFT One is hidden and the pointer changes to a pointing hand. In some environments, test objects are highlighted as you hover over your application.

  2. In your application, click the object you want to add to your object repository.

  3. If the location you click is associated with more than one object, select the object you want to add from the ones displayed in the Object Selection Dialog Box .

    • If the selected object is the bottom of the hierarchy, the object is added directly to the object repository.
    • If the selected object is a parent object, define the child objects you want to add in the Define Object Filter Dialog Box.

    The new object's parent objects are also added, if they do not already exist in the object repository.

Local objects are shown in black in the object repository tree to indicate they are editable; shared objects are shown in gray and can be edited only in the Object Repository Manager.

Back to top

Add a test object while editing a step

Add a test object to your local repository while editing your test or component.

To add a test object:

  1. In the Item cell of the Keyword View, from the drop-down list, select Object from repository.

  2. In the Select Test Object Dialog box, select the object to add.

  3. Click OK to create a step using the selected object.

The selected step is added to the test and the object is added to the action or component's local object repository.

Back to top

Define a new test object

Define a test object and add it to the object repository.

To define a new test object:

  1. Select the object under which you want to define the new object, according to the correct object hierarchy.

  2. Click the Define New Test Object button or select Object > Define New Test Object. The Define New Test Object Dialog Box opens.

  3. In the Environment drop-down list, select the UFT One add-in environment for your object.

  4. In the Class drop-down list, select the object type.

  5. In the Name edit box, give the object a name.

  6. In the Test Object details area, provide the necessary description properties for the object.

  7. Click Add to insert the new object in the object repository.

  8. Click Close to return to the main object repository window.

Back to top

Add a test object with the Object Spy or OIC

Use the Object Spy or OIC to spy on a test object and add it to your object repository.

To add a test object with the Object Spy or OIC:

  1. Click the Object Spy button or OIC button from UFT One toolbar or the toolbar in the Object Repository window or Object Repository Manager.

  2. Spy on an object and add it to the object repository. See Add objects to the object repository or Add objects to an object repository.

Back to top

Add test objects by capturing all objects

Use the Capture function to capture all objects in a selected area of your application.

To add test objects by capturing:

  1. Open your application to the correct page, window, or section of the application.

  2. In the toolbar, click the Capture button .

  3. In your application, select the top level object you want to capture.

  4. When the mouse pointer changes into a crosshairs, click and drag to select the area that contains the objects you want to capture.

    UFT One displays a flashing rectangle around the selected area of your application, and pauses while it learns the objects.

    The learned objects are added to the action's local object repository.

Back to top

Add a test object from the Active Screen

Use the Active Screen to add a test object to your object repository.

To add a test object from the Active Screen:

  1. If the Active Screen is not displayed, select View > Active Screen.

  2. Select a step in your test whose Active Screen contains the object that you want to add to the object repository.

  3. In the Active Screen, right-click the object you want to add and select View/Add Object.

  4. If the location you clicked is associated with more than one object, the Object Selection Dialog Box opens. Select the object you want to add to the object repository, and click OK to close the Object Selection dialog box.

    The Object Properties Dialog Box opens and displays the default description properties for the object.

Back to top

Add a test object by inserting a step from the Active Screen

Use the Active Screen to insert a step and add a test object into your object repository.

To add a test object by inserting a step:

  1. If the Active Screen is not displayed, select View > Active Screen.

  2. Select a step in your test whose Active Screen contains the object for which you want to add a step.

  3. In the Active Screen, right-click the object for which you want to add a step and select the type of step you want to insert (checkpoint, output value, or Step Generator).

  4. If the location you clicked is associated with more than one object, the Object Selection Dialog Box opens. Select the object for which you want to add a step, and click OK.

    The appropriate dialog box opens, enabling you to configure your preferences for the step you want to insert.

  5. Set your preferences and select whether to insert the step before or after the step currently selected in the Keyword View or in the Editor. Click OK to close the dialog box.

    A new step is inserted in your test, and the object is added to the local object repository for the current action (if it was not yet included).

Back to top

See also: