Work with Insight test objects

Relevant for: GUI tests and components

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

Add an Insight object

  1. Click the Add Insight Object to Local toolbar button .

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

    Note: If you previously selected Do not show me again on the Select Learn Mode dialog box, the learning session automatically begins using the mode you used most recently.

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

    Automatic learn mode

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

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

    This mode is the faster mode and should be satisfactory 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 in the application, manually specifying the borders of the control.

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

    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 or in your application.

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

  3. In the Add Insight 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.

    • Specify areas to exclude from the test object image. UFT 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.

An InsightObject, named InsightObject, is added to the object repository, under the test object that represents the application or window that contains the control.

Back to top

Modify an Insight 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.

Back to top

Retrieve text from an Insight Object

Use the Insight.GetVisibleText test object method to retrieve text displayed on the object. UFT 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 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 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 searches for the object anywhere on the screen.
  • Add a similarity to the test object description.

    For details, see the InsightObject description propertiesInsightObject description properties topic in the UFT 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