Run Mobile tests

This topic describes details about running Mobile tests in UFT.

UFT Mobile test run flow

In UFT, ensure that you are connected to Mobile Center, and click Run.

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

Tip: Improve test performance and speed by setting your UFT 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 determines the device and application as follows:

After UFT determines the device and application, the device is locked, so that only UFT 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 application after run is selected in the record and run settings, Mobile Center uninstalls the application from the device.

The device is released, making it available for other Mobile Center 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.

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 Device Metrics options were selected in the Record and Run Settings dialog.

Log files are stored for each device, locally on the UFT 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 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 Mobile Center 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 a App.Launch method before the steps performed on each application. This enables UFT 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 MC Browser app.

    Note: The MC Browser app is a built-in, packaged and ready-to-use Mobile Center app. For more details, see the Mobile Center 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 MC Browser app:

    iOS: com.hp.HPMobileWebBrowserINJ

    Android: com.hp.mobileweb

    For more details, see the Mobile Center 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("MC 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 tests in parallel on mobile devices.

For details, see Run parallel web and mobile tests.

Back to top

Use virtualized networks for UFT 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 Mobile Center. For details, see the Mobile Center Help.

  3. In your UFT 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, see the Mobile section of the UFT Object Model Reference.

Back to top

See also: