Creating an AFT suite for mobile tests

When you want to run a single mobile test on multiple devices, multiple mobile tests on a single device, or multiple mobile tests on multiple devices that are hosted on a local computer or remote agent computer, you can create an Accelerated Functional Test suite (AFT) suite for mobile tests.

Before you begin

You must have completed the following tasks:
  • Connected the devices and configured the emulators or simulators on the local or remote agent computer.
  • Provided the IP address of the Appium server.
    Note: It must be same as the IP address of the local or remote agent computer on which you want to run tests.
  • Provided the following details:
    • The IP address of the Appium server.
    • The port number of the Appium server.

About this task

To run the tests as an AFT suite, you must create an XML file where you can specify the test details. You can use this XML file to run these tests anytime later and you can also add more tests, and devices to extend the tests.

You can refer to the following table to know the format of the device id for each of the devices that you use in the AFT suite:
Device name Device id format
Android emulator Emulator:<Name of Android emulator with the space replaced with underscore>

For example, if the emulator name is Pixel 2 API 30, then device id is Emulator:Pixel_2_API_30

Android real device Android:<Name of Android real device with the space replaced with underscore>

For example, if the real device name is Pixel 4, then device is Android:Pixel_4

iOS simulator Simulator:<Name of iOS simulator_iOS version>

For example, if the iOS simulator name is iPhone 11 Pro and iOS version is 14.4, then device id is Simulator:iPhone 11 Pro_14.4

iOS real device iOS:<Name of iOS device_iOS version_UUID>

For example, if the iOS real device name is My iPhone, iOS version is 14.4, and device UUID is 445f47e79c803c95cd8ef4f2429c61e0b032abdc, then device id is iOS:My iPhone_14.4_445f47e79c803c95cd8ef4f2429c61e0b032abdc

Restriction:
  • The AFT suite must contain either Android tests or iOS tests.
  • You cannot run one or more single mobile tests and Compound tests that contain a mix of mobile and Web UI or any other supported tests in an AFT suite. The AFT suite must contain only mobile tests or a Compound test that contains only mobile tests.
  • Each group can contain only one location. You can use multiple groups to run tests on multiple locations. You cannot have multiple groups for the same location.
  • Each group can contain either mobile test scripts only or a Compound test that contains mobile test scripts.

Procedure

  1. Create an XML file to specify the details of the test suites, devices, and the location by performing the following steps:
    1. Click File > New > Other.

      The Select a wizard dialog box is displayed.

    2. Select the XML File in the XML section and then click Next.

      The available projects are displayed.

    3. Select a project where you want to save the XML file, enter a name for the XML file in the File name field, and then click Next.
    4. Select the Create an XML file from an XML template option and click Finish.

      A blank XML document opens.

    5. Click the Source tab of the XML document.
    6. Provide the necessary details in the XML file, and then save the file.
      Note: You must provide appium.server.port number only when the Appium server is running on a different computer. When you run tests on the same computer where Appium is installed, you need not mention the appium.server.port number.

      A sample format of the XML file is as follows:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <inits id="N3E78C8006B211EB9003B7CBBD8B707A"
    type="com.ibm.rational.test.ft.aftsuite">
    <group>
        <tests>
            <test path="<Path of the mobile test1>" />
            <test path="<Path of the mobile test2>" />
        </tests>
        <devices>
            <device id="<Device type1:Device id1>" />
            <device id="<Device type2:Device id2>" />
        </devices>
        <locations>
            <location host = "<local or remote host>"
            appium.server.host = "<IP address of the Appium server>"
            appium.server.port = "<Port number of the Appium server>" />
        </locations>
    </group>
    <group>
        <tests>
            <test path="<Path of the mobile test3>" />
            <test path="<Path of the mobile test4>" />
        </tests>
        <devices>
            <device id="<Device type1:Device id3>" />
            <device id="<Device type2:Device id4>" />
        </devices>
        <locations>
            <location host = "<local or remote host>"
            appium.server.host = "<IP address of the Appium server>"
            appium.server.port = "<Port number of the Appium server>" />
        </locations>
    </group>
    </inits>
    

    In the following example, you can see that for each group of tests, you can specify a single location only.

    For example,
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <inits id="N04408500ADA11EABD15B2C0CB4A9F45"
    	type="com.ibm.rational.test.ft.aftsuite">
    <group>
        <tests>
            <test path="/MobileProject1/CmpTest1.testsuite">
            </test>
        </tests>
        <devices>
            <device id="Emulator:Pixel_API_29"></device>
            <device id="Emulator:Pixel_API_30"></device>
        </devices>
        <locations>
            <location host="localhost" appium.server.host="localhost" appium.server.port="4723"></location>
        </locations>
    </group>
    <group>
        <tests>
            <test path="/MobileProject1/Tests/Copy of APIDemoDebug_Accessibility1.testsuite"></test>
            <test path="/MobileProject1/Tests/Copy of APIDemoDebug_App.testsuite"/>
        </tests>
        <devices>
        <device id="Emulator:Pixel_3a_API_29"></device>
        </devices>
        <locations>
            <location host="10.115.160.202" appium.server.host="10.115.160.202" appium.server.port="4723"
            ></location>
        </locations>
    </group>
    </inits>
  2. Click OK.

Results

You have created an AFT suite to run mobile tests.