Record an AI-based test

Mobile, web, and windows-based SAP GUI tests

This topic describes how to record AI-based test steps.

Note: This task is part of a higher-level task. For details, see Add AI-based steps to your tests.

Overview

Use AI Object Record to simplify test creation and improve test automation. Following your clicks, AI Object Record learns objects and creates test steps. The recording result is a resilient test that can run on multiple platforms and environments.

Recording an AI-based step is made up of three parts: Inspect, Add, and Run.

  • Inspect: AI Object Record inspects a web page, a mobile application, or an SAP GUI for Windows application to identify objects you can use in an AI-based test. For supported object types, see AI-based testing: Supported control types.
  • Run: Click on an object, and AI Object Record runs an operation on the application, preparing to add it to the test.

  • Add: AI Object Record adds the step to the test.

AI Object Record records a default operation for the object according to its type, unless you select a different operation.

Note:  

  • AI Object Record adds AIUtil steps to the test for operations supported by AI. It does not add AI objects to any object repository.
  • AI Object Record is not affected by the Record & Run settings.

Back to top

Prerequisites for recording on an application

Before recording on an application, review the following requirements:

If you are testing a web application
  1. Make sure your browser is set up to work with UFT One. For details, see Test Web apps on specific browsers.

  2. Load the Web Add-in when you open UFT One.

  3. Open the browser only after opening UFT One.

If you are testing an application on a mobile device
  1. Load the Mobile Add-in when you open UFT One.
  2. Connect to Digital Lab. For details, see Set up UFT One for advanced mobile testing.

  3. Choose Tools > Open Application on Mobile Device in UFT One toolbar.
  4. In the Open Application on Mobile Device dialog box, select a device and an application.

If you are testing an SAP GUI for Windows application

  1. Make sure that you perform the following tasks as described in Enable support for SAP GUI for Windows.

    1. Install SAP GUI Scripting.

    2. Enable SAP GUI Scripting on the server side.

    3. Enable SAP GUI Scripting on the client side.

  2. Load the SAP Add-in when you open UFT One.

  3. Open your application only after opening UFT One.

Back to top

Record a step using AI Object Record

Use AI Object Record to record AI-based test steps on a web, mobile, or an SAP GUI for Windows application.

To start a recording session:

  1. In the toolbar, open a test and click the AI Object Record button.

    UFT One is minimized, and the AI Object Record toolbar opens at the top of the screen and begins initializing.

    You can drag the AI Object Record toolbar to any place you want on the screen.

  2. Click the open application.

    AI Object Record inspects the application and highlights the identified objects. Visual elements and texts are highlighted in different colors.

    In UFT One, an AIUtil.SetContext step is automatically added to your test.

    In the Settings of the AI Object Record toolbar, select the Visual Elements and/or Texts check boxes to specify the type of object you want to highlight.

    If AI Object Record does not clearly highlight all identified AI objects, do one of the following:

    • Click the Refresh button to inspect the application again.
    • Click the Settings button and increase Delay Time, so that the tool waits more time before inspecting again. (Default: 3s, Range: 0-60s)

    Note: The toolbar settings remain the same the next time you launch AI Object Record.

  3. Click a highlighted object, or hover over one to select an operation other than the default operation in the pop-up dialog box.

    Note: When testing non-mobile applications, we recommend selecting SetText to set the value of a text box, rather than the default Type, which sends key inputs to the control.

    AI Object Record runs the selected operation on the object. It adds the step to the test only after the operation is successful.

    For input fields, search boxes, and combo boxes, AI Object Record may prompt you to enter a value for the recorded step.

    You can see the recording progress, step code, recording result, as well as error messages from the toolbar.

    • To stop the recording, press the exit button to close the toolbar.
    • To pause the recording, click the Pause button on the toolbar. You can then click the Resume button later to resume the recording.
    • To record on another application, click the Select application to inspect button to select the application as a new context on the toolbar.

      Note: Make sure that you pause or stop the current recording process before you move to record on another application.

    • To resume recording on a new tab that your recorded flow opens, select the new one as a new context.
  4. Once a step is added, AI Object Record automatically reinspects the application. After the inspection is complete, repeat the above step to add more AI-based steps to your test.

    To identify objects that are not supported by AI, click the Object Identification Center button on the toolbar to spy them, and manually add spied objects to your test.

  5. To better identify an AI object during recording, hover over the object and edit Text, Position, or Relation in the pop-up dialog box.

    If AI Object Record recognizes more than one possible text result for an object, the dialog box provides several text options for you to select. The text option you selected is verified by AI Object Record to ensure a valid identification result.

    If the captured texts are incorrect, you can edit the text yourself to uniquely identify the object or click Ignore text to not identify the object by text. AI Object Record will verify your edited text to ensure unique identification.

    Modify the originally learned properties to create a new unique description.

    You can specify properties that do not each uniquely describe the object. If the combined description does not uniquely describe the object, your changes are discarded when the pop-up dialog box closes.

Back to top

Add a checkpoint during recording

During recording, you can add a checkpoint. That means that you can check the existence or state of an object.

Note:  

  • The checkpoint for verifying existence applies to all visual elements and texts.
  • The checkpoint for verifying states applies to only objects with an On/Off state, such as toggles, check boxes, and radio buttons.

To add a checkpoint

  1. Hover over a highlighted object you want the test to check.

    A pop-up dialog box opens, in which you can add a checkpoint for the object.

  2. Click Add Checkpoint in the pop-up dialog box.

  3. Select Exist or Not Exist for verify existence.

    Select True to check if the state is On or False to check if the state is Off.

Back to top

Add a relation during recording

During recording, you can add a relation. That means that you can specify another AI object in proximity to the one you want to identify, that helps identify this one.

To add a relation

  1. Hover over a highlighted object you want to identify.

    A pop-up dialog box opens, in which you can add a relation for the object.

  2. Click the Add Relation button in the pop-up dialog box.

  3. Click on another object in proximity to add the relation.

    A blue dot appears next to the object you want to identify.

    You can also see and edit the relation direction used in your object description.

    To remove the added relation, hover over the object again and click the Remove Relation button in the pop-up dialog box. AI Object Record then validates the object and restores the relation in case the object becomes invalid.

    Note:  

    • You can select only available objects in proximity on the web page or application.
    • You cannot add a relation if the object you selected has a circular relation with the object you want to identify. Circular relation: A series of objects defined by their proximity to one another, where the last object is defined by its proximity to the first.

Back to top

Add a position during recording

During recording, you can add a position for an object. The position helps identify the object but cannot be added together with the relation.

To add a position

  1. Hover over a highlighted object you want to identify.

    A pop-up dialog box opens, in which you can add a position for the object.

  2. Click the Add position button in the pop-up dialog box.

  3. Select the direction and index for the object.

    AI Object Record automatically verifies the selected values. An error message appears if the values are invalid.

    To remove the added position, hover over the object again and click the Remove position button in the pop-up dialog box.

Back to top

See also: