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 the AI Record to simplify test creation and improve test automation. Following your clicks, the AI 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 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 Record runs an operation on the application, preparing to add it to the test.
-
Add: AI Record adds the step to the test.
When using AI Record to create test steps:
-
AI Record records a default operation for the object according to its type, unless you select a different operation.
- AI Record adds AIUtil steps to the test for operations supported by AI. It does not add AI objects to any object repository.
- AI Record is not affected by the Record & Run settings.
Prerequisites for recording on an application
Before recording on an application, review the following requirements:
If you are testing a web application |
|
If you are testing an application on a mobile device |
|
If you are testing an SAP GUI for Windows application (UFT One version 2022 and later) |
|
Record a step using AI Record
Use AI Record to record AI-based test steps on a web, mobile, or an SAP GUI for Windows application.
To start a recording session:
-
In the toolbar, open a test and click the AI Record button.
UFT One is minimized, and the AI Record toolbar opens at the top of the screen and begins initializing.
You can drag the AI Record toolbar to any place you want on the screen.
-
Click the open application.
AI 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 AI Record toolbar, select the Visual Elements and/or Texts check boxes to specify the type of object you want to highlight.
If AI 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 the AI Record.
-
Click a highlighted object, or hover over one to select an operation other than the default operation in the pop-up dialog box.
UFT One 2023 or later: 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 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, the AI 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.
-
Once a step is added, AI 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.
-
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 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 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 Record will verify your edited text to ensure unique identification.
UFT One version 2022 and later 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.
UFT One version 2021 R1 and earlier Each property you include in the description must uniquely describe the object. Otherwise, you cannot edit other properties, and you cannot save the description.
If the object can only be described uniquely by multiple properties, create the description in the test script.
UFT One 2022 or earlier: Selecting items from a combo box is a complex operation. The Select action is supported on a combo box identified by AI only if UFT One can also identify the combo box as a WebList or a MobileDropDown.
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
-
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.
-
Click Add Checkpoint in the pop-up dialog box.
-
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.
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
-
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.
-
Click the Add Relation button in the pop-up dialog box.
-
Click on another object in proximity to add the relation.
A blue dot appears next to the object you want to identify.
UFT One version 2022 and later: 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. The AI 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.
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
-
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.
-
Click the Add position button in the pop-up dialog box.
-
Select the direction and index for the object.
The AI 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.
See also: