Test Android system apps

Before creating a UFT One test to run on an Android system app, you must retrieve relevant Android property values and map them to UFT One or Digital Lab (UFT Mobile) properties.

Then, use those properties as argument values in your UFT One test steps.

Retrieve and map Android property values

Retrieve the required property values using the uiAutomatorViewer tool.

Do the following:

  1. Access the uiAutomatorViewer tool. For details, see Analyze your app's user interface.
  2. Retrieve values for the following properties:

    package

    The identifier of the application currently in view.

    Mapped to the identifier property of the App test object.

    content-desc

    The accessibilityid property of the object.

    class

    Mapped to the class property of the test object.

  3. Open a test in UFT One, and record a step on any app. For example:

    Device("Device").App("UICatalog").MobileList("List").Select 0
  4. Manually adjust the various parts of the step according to the following example.

    Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True”).MobileView("class:=Label", "accessibilityId:=Applications").Tap

    Device

    Use one of the following:

    Device("DeviceName") if the device test object is defined in the object repository

    Device("micclass:=Device") if you want to use a programmatic description

    Identifier

    Define the application identifier.

    This value is mapped to the package property in the uiAutomatorViewer.

    systemApp Set systemApp:=True.
    class

    Define the test object class property.

    accessibilityId Set "accessibilityId:=Applications".

Continue by creating additional test steps and running your test.

For details, see Record Mobile tests, Edit Mobile tests, and Run Mobile tests.

Back to top

Android system app test example

The following steps show how to access the calculator system app, add numbers, calculate the result, and then clear the display:

' Navigate to the Home page on the device
Device("micclass:=Device").Home
' Navigate to the list of apps on the device
Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True”).MobileView("class:=Label", "accessibilityId:=Applications").Tap
' Swipe to navigate to the calculator app
While Not Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True").MobileView("class:=Label", "accessibilityId:=Calculator").Exist(5)
    Device("micclass:=Device").Swipe "left"
Wend

' Open the calculator app
Device("micclass:=Device").App("Identifier:=com.sec.android.app.launcher", "systemApp:=True").MobileView("class:=Label", "accessibilityId:=Calculator").Tap
' Press 1 on the calculator
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=1").Tap
' Press + on the calculator
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=Addition").Tap
' Press 5 on the calculator
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=5").Tap
' Press = on the calculator
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=Equal").Tap
' Press C (Clear) on the calculator
Device("micclass:=Device").App("Identifier:=com.sec.android.app.popupcalculator", "systemApp:=True").MobileView("class:=ImageButton", "accessibilityId:=Clear").Tap

Back to top

See also: