Record Mobile tests

This topic describes how to record UFT One tests on your mobile apps.

Mobile recording prerequisites

Ensure you have the following completed before starting to record your GUI test or component:

Set up your environment

Test your connection to Digital Lab or to a local device and verify your Record and Run Settings.

For details, see Set up UFT One for advanced mobile testing.

App packaging and signing

You may need to set up packaging and signing services, or to prepare your apps before you start.

For more details, see the Digital Lab Help.

Retrieve properties for Android system apps

Retrieve Android properties as needed, and map them to UFT One or Digital Lab properties.

For details, see Test Android system apps.

Back to top

Basic mobile recording steps

To record steps on a mobile application:

  1. Start your recording session:

    In UFT One, select Record > Record. A remote access window opens, connected to the device you specified.

  2. Perform your steps on your device in the remote access window.

    UFT One records your operations and adds test objects to the object repository as you go along.

    In the object repository, the mcindex description property is used instead of the Ordinal Identifier mobile test object property.

    Note: Low-Level recording is not supported.

  3. When you're done, click Stop.

    The remote desktop window remains open with your device, and you can continue to use the device. However, the device is also released, making it available for other Digital Lab users.

Back to top

Record Insight steps for web apps on your mobile device

Insight helps you identify test objects in your app based on what they look like on your screen, instead of their properties or technology.

Use Insight to capture images and run steps on objects in your app that might otherwise be unavailable to UFT One.

  1. Start your recording session.

  2. In the remote access window:

    • Browse to the device's HOME screen
    • Ensure that your remote access window is set to 100% zoom.
  1. In the Record Toolbar, in the Recording Mode drop down list, select Insight Recording.

  2. In the remote access window, in the mobile device, launch the device browser and navigate to the web application you want to test.
  3. Record the necessary steps on the device's browser. While you record, UFT One adds steps and objects to the test and object repository, respectively.

    Each object you use is recognized as an InsightObject under the parent Device test object.

  4. Click Stop to stop the recording session.

The following code is an example of Insight steps recorded on a device.

Device("Device").Home
Device("Device").InsightObject().Click
Device("Device").InsightObject().Click

Back to top

Record a simulated event

Record simulated events, such as receiving an SMS, to test that your app responds properly to those events.

Note: Simulated events are not actual events. So, for example, a simulated incoming call cannot be answered, and a simulated SMS cannot be opened.

Record simulated events

  1. Define your Record and Run Settings, and start recording.

  2. (Optional) In your test, move your cursor to where you want to add the simulated event.

  3. In the Options pane in the remote access window, click the button for the required simulation.

    The relevant dialog box opens for the selected simulation and prompts you for details.

    Incoming SMS

    Incoming phone call

    Send app to background

    GPS relocation

    Set the duration from 1-15 seconds.

    Use numerical GPS coordinates. Valid values:

    • Latitude: min: -90, max: 90
    • Longitude: min: -180, max: 180

    Camera Simulation

    Specify the location of the photo (on the file system or URL)

    Video Simulation

    Specify the location of the photo (on the file system or URL)

    Lines are added to your test for the simulation you defined. For example:

    Device("Device").IncomingSMS "1800859645","Hello There",5,True
    
    Device("Device").GPSRelocate 37.555000,-122.500000
    Device("Device").App("PhotoViewer").SimulateCamera chd23421
    Device("Device").App("PhotoViewer").SimulateVideo chd23421
  4. Stop recording.

  5. If you added a SimulateCamera or SimulateVideo step, you may need to add a StopSimulateCamera and StopSimulateVideo step manually after recording.

Tip: Learn more about gestures and view code examples for simulated events in the Mobile section of the UFT One Object Model Reference for GUI Testing.

Back to top

Add checkpoints and output values

Add checkpoints and output values for your device test objects during recording sessions. Supported checkpoints include standard, bitmap, and text checkpoints.

To insert a checkpoint or output value:

  1. In the Record Toolbar, click the Insert Checkpoint or Output Value button and select the type of checkpoint or output value you want to add.

  2. In the remote access window, click the device to select it.

  3. In the Object Selection dialog box, select the Device test object.

  1. In the Checkpoint Properties dialog box or Output Value Properties dialog box, specify the settings for the checkpoint object or output value step. For example:

  2. To reuse a checkpoint or output value step, select one of the following:

    • Design > Checkpoint > Existing Checkpoint

    • Design > Output Value > Existing Output Value

Back to top

Record tests on hybrid apps

When working with hybrid mobile apps, you must wait for a page to load completely to record steps performed on that page.

This ensures that UFT One can properly identify the objects on that page in both recording and run sessions. A page that has not yet completely loaded may have missing objects, or objects in the wrong locations.

In such cases, add a Wait statement to allow the web page to load completely before the steps are run.

The following code is an example of a Wait statement added before a checkpoint step:

Device("Device").App("Mobile Browser_2").MobileEdit("url").SetFocus
Device("Device").App("Mobile Browser_2").MobileEdit("url").Set "http://mysite.com"
//wait 10
Device("Device").Check CheckPoint("Device_11")

For more details, see Test hybrid apps with UFT One.

Back to top

Use text recognition

Use text recognition to verify or retrieve text in your objects during a recording, run, or spy session.

Note:  

  • Text recognition on mobile devices depends on UFT One's OCR engine. For more details, see Text recognition in run-time.
  • Do not move or close the Text Search Utility dialog box while the text recognition is processing.

Use the Text Search Utility to create text steps:

  1. Define the Record and Run Settings for your app and device, and start recording.

  2. In top-left corner of the remote access window, click the OCR button.

  3. In the Text Search Utility dialog box, click near the text string you want to recognize, or search for the text string you want to recognize in the Text to Search field.

  4. Click one of the following:

    • Perform Command / Refresh. Perform the command on the device without adding a step to your action.

      The device image is updated in the remote access window.

    • Add Line. Add the step as a new line in your current action. For example:

      Device("Device").ClickOnText "Camera",3

Back to top

See also: