Work with Insight or Text test objects

Relevant for: GUI tests and components

Add Insight or Text objects to the object repository directly from the application, or even from a picture of the object displayed on your screen.

Note: Text objects are supported in UFT One versions 15.0.2 and later.

Add an Insight or Text object

  1. In the Object Repository Manager or the Object Repository window, click the Add Insight Object to Local or Add Text Object to Local toolbar button.

  2. In the Select Learn Mode dialog box, select the mode you want for learning the object (Automatic learn mode | Manual learn mode), and then select the control or text.

    Note: To display the Select Learn Mode dialog box, enable this option in the Options dialog box (Tools > Options > GUI Testing tab > Insight & Text Objects node).

    Automatic learn mode

    The pointer changes to a pointing hand. Click on the control or text in the application.

    UFT One automatically detects the borders of the control or text, and takes a snapshot of it.

    This mode is the faster mode and should be satisfactory for Insight objects in most cases.

    Manual learn mode

    The pointer changes to a crosshair, with an adjacent circle displaying a magnified image of the area around the center of the crosshair.

    Example:  

    Take a snapshot of the control or text in the application, manually specifying the borders of the control or text.

    Use this mode in cases where the automatic mode does not correctly detect the borders of the control or text, such as when it selects an area of the application which is much larger than the area you want.

    By holding the left CTRL, you can temporarily change the pointing hand or crosshair to a standard pointer.

    This enables you to change the window focus or perform operations in UFT One or in your application.

    UFT One takes a snapshot of the control or text, and the Add Insight Test Object or Add Text Test Object dialog box opens.

  3. In the Add Insight Test Object or Add Text Test Object dialog box, you can:

    • Adjust the borders of the image saved with the test object in the object repository.

    • Take a new snapshot to replace the image entirely.

    For Insight objects:

    • Specify areas to exclude from the test object image. UFT One will ignore these areas when it searches for the image on the screen to identify the object.

    • Modify the test object's ClickPoint. This is the location to click in the control when running a test object method on it.

A new test object is added to the object repository, under the test object that represents the application or window that contains the control or text. The selected image is saved with the test object.

  • An Insight object is named InsightObject, and the saved image is used to identify the control in the application.
  • For a Text object, UFT One uses OCR to extract the text from the image and save it in the test object. The test object name is then based on the extracted text, and the text is used to identify the relevant text in the application.

Back to top

Define a new Text test object

You can create a Text test object in the object repository by description, specifying the text to use to identify the object in the application.

Use the Define New Test Object button in the as described in Define a new test object.

In the Environment drop-down list, select IBA. Then select the TextObject class and specify the properties to use for the object identification.

Back to top

Modify an Insight or Text test object's image

  1. In the Object Repository window or Manager, select the test object whose image you want to modify.

    If you are in the Editor, double-click the test object's image in a step.

  2. In the Test object image area, click the Change Test Object Image button.

If you modify the image of a Text object, the test object's text property, used to identify the text in the application, is updated as well.

Back to top

Retrieve text from an Insight Object

Use the Insight.GetVisibleText test object method to retrieve text displayed on the object. UFT One uses the OCR mechanism to recognize and return the text.

Use this text for verification purposes, or as a way of differentiating between objects or states of the application.

    Example:
  • If the text on a button in your application changes when an operation succeeds, check that text to verify success.

    Make sure to use "exclude areas" to ignore the text area in the Insight object definition.

  • If you have two similar objects in your application, that are different only because of their text, learn them both as the same object, using "exclude areas" to ignore the text in the image.

    Then, use GetVisibleText to check the text on the object and differentiate between the two objects in your test or component.

For more details, see the Insight section of the UFT One Object Model Reference for GUI Testing.

Back to top

Update Insight test object details

Do any of the following to improve the readability and efficiency of your test or component:

  • Rename the test object to a name that describes the control it represents. (Recommended)

  • Move the test object within the test object hierarchy:

    If you place it under another test object...

    ...UFT One searches for the object in the application only within its parent test object.

    If you move the Insight test object to be a top-level object... ...UFT One searches for the object anywhere on the screen.
  • Add a similarity to the test object description.

    For details, see the InsightObject description properties topic in the UFT One Object Model Reference for GUI Testing.

  • Modify the ordinal identifier created for the test object. For details, see Ordinal identifiers.

  • Define visual relation identifiers for the test object. For details, see Visual relation identifiers.

For more details , see Maintain test objects in object repositories.

Tip: When you have finished modifying all of the Insight test objects, delete all of the snapshots to reduce the amount of disk space used. This does not delete the test object images used for object identification.

Select Tools > Delete Insight Snapshots.

Back to top