Run Mobile tests

This topic describes details about running Mobile tests in UFT.

UFT One Mobile test run flow

In UFT One, ensure that you are connected to Digital Lab (UFT Mobile) or to a local device, and click Run.

UFT One connects to the device and the remote access window opens, enabling you to view the application's behavior as UFT One runs the test steps.

Tip: Improve test performance and speed by setting your UFT One options to hide the remote access window.

For details, see Show device during test run, required for Insight and bitmap checkpoints.

During a Mobile run session

When the run reaches a step on a mobile test object, UFT One determines the device and application as follows:

After UFT One determines the device and application, the device is locked, so that only UFT One can perform actions on it. The steps run as configured.

During a run session, view the data by expanding the Metrics panel on the right side of the remote access window.

The end of a Mobile run session

When a run session ends, if Uninstall is selected in the record and run settings, Digital Lab (UFT Mobile) uninstalls the application from the device.

The device is released, making it available for other Digital Lab (UFT Mobile) users.

The run results are then displayed, including a general run summary, details and statuses for each step, and the following:

Images of the application

Screenshots of the device at various steps, if configured to do so.

Set this option in the Screen Capture pane (Tools > Options > GUI Testing > Screen Capture > Save still image captures to results)

For details, see Use run results. If you are using the Run Results Viewer, see Using the Run Results Viewer.

Note: For devices stored on an AWS device farm, this option requires UFT Mobile 3.4 or later.

Local System Monitor pane

Displays the device metrics, as configured in the Device Metrics fields of the Record and Run Settings dialog box.

Note: If you have both Device Metrics and Local system monitoring enabled, the run results shows data captured by the Device Metrics settings.

For details, see Use run results. If you are using the Run Results Viewer, see Using the Run Results Viewer.

Device Logs node

A list of device logs, collected every 3 seconds if Device Metrics options were selected in the Record and Run Settings dialog.

Log files are stored for each device, locally on the UFT One computer in the run results folder.

  • Android: Logcat log files, filtered by the application being tested.
  • iOS: idevicesyslog files, unfiltered.
StopNV step
(if this step type was included in the run)

A path to the Network Virtualization results file, stored on the Network Virtualization server. This file contains traffic and performance information and analysis.

Back to top

Run tests with Insight

Tests containing Insight test objects run like any other UFT One test.

However, if the remote access window fails to completely load the user interface, Insight steps may be skipped if those test objects are displayed.

Additionally, Insight steps that were recorded on high-resolution devices (with displays of 1.5 megapixels or higher), using UFT Mobile 1.10 or earlier, the image comparison may fail.

In such cases, modify the image in the object repository to adjust the image borders or the location to click.

For more details, see:

Back to top

Run tests on multiple apps

If a test is designed to run on multiple apps during a single run session, make sure that the test is configured to open the each application separately before running the test.

Then, in the test run, add an App.Launch method before the steps were performed on each application. This enables UFT One to ensure that the application is open before trying to perform the necessary steps.

For details, see:

Back to top

Run tests on multiple devices

When running a test that contains steps on multiple devices, all remote access windows open layered in the same location, overlapping each other.

The windows remain in a stationary position for the duration of the run session. Running a step on a "hidden" remote access window does not move the window to the foreground. This can prevent steps, including Insight steps, from running correctly.

To solve this, add the following code to the test (or a function library):

'@Description Activate the remote access window for the device
Public Function Device_ActivateRemoteWindow(ByRef device)

       raWindowHwnd = device.GetROProperty("hwnd")
       Window("is child window:=False", "hwnd:=" & raWindowHwnd).Activate       

End Function
RegisterUserFunc "Device", "ActivateRemoteWindow", "Device_ActivateRemoteWindow"

For more details, see Cross-platform testing.

Back to top

Run a single test across multiple operating systems

Create a test for a website or web app on one mobile operating system (for example, Android), and then run that same test on another mobile operating system (for example, iOS).

  1. Record your test using a supported native browser, or the Digital Lab Browser (UFTM Browser) app.

    Note: The Digital Lab Browser (UFTM Browser) app is a built-in, packaged and ready-to-use Digital Lab (UFT Mobile) app. For more details, see the Digital Lab (UFT Mobile) Help.

  2. In your test, create the following input action parameters:

    device_id

    The device's UUID.

    This is displayed as the device ID in the Mobile Device Selection dialog box, under the device image.

    identifier

    The unique identifier for the app (bundle identifier / app ID).

    For example, to use the Digital Lab Browser (UFTM Browser) app:

    iOS: com.hp.HPMobileWebBrowserINJ

    Android: com.hp.mobileweb

    For more details, see the Digital Lab (UFT Mobile) Help.

    For more details, see Use action and test parameters.

  3. Add steps to the beginning of your test to define the device and app IDs.

    For example:

    Device("Device").SetTOProperty "id", Parameter("deviceId")
    Device("Device").App("Mobile Browser").SetTOProperty "identifier", Parameter("identifier")
    
  4. In the object repository, edit the Device test object to add the description property id.

    Then, modify the device and app IDs to set their properties using any of the following methods:

For more details, see Cross-platform testing.

Back to top

Run multiple tests in parallel

Use the ParallelRunner CLI tool to run multiple UFT One tests in parallel on mobile devices.

For details, see Run UFT One tests in parallel using a command line.

Back to top

Use virtualized networks for UFT One Mobile tests

During your test runs, use virtualized networks for your mobile devices to test the mobile device's performance in a variety of different scenarios, with differing network performance.

  1. In Network Virtualization, create different profiles to simulate varying network conditions. For details, see the Network Virtualization Help Center.

  2. Configure your NV integration with Digital Lab (UFT Mobile). For details, see the Network Virtualization Help Center.

  3. In your UFT One test or component, insert a Device.StartNV <profile name> statement to apply the network conditions defined in the network virtualization profile.

  4. At the end of the test, or earlier if relevant, insert a Device.StopNV statement to stop running the virtualized network.

For details about devices and methods supported by UFT One, see the Mobile section of the UFT One Object Model Reference.

Back to top

See also: