Creating and Running Mobile Tests

Applies to TestComplete 14.90, last modified on June 15, 2021

About

In TestComplete, you create automated tests for mobile applications running on devices controlled by the BitBar mobile device cloud or by a private Appium server. The easiest way to create a test is to record it.

Before recording tests

Make sure that all requirements and prerequisites are met:

1. Plan your test

  1. Decide on the purpose of your test.

  2. Consider what steps your test should contain and over which application parts these steps are to be performed.

  3. Think of what the outcome of the steps will be and how your test will verify the outcome.

2. Connect to the mobile device and start a testing session

For your tests to be able to access your mobile application, connect to the server that controls the device, install the application to the target device, and open a testing session for it:

In the BitBar device cloud

  1. Click Show Mobile Screen on the TestComplete toolbar.

    Note: If the button is hidden, you can make it visible as it is described in Customizing Toolbars and Menus.

  2. TestComplete will open the Mobile Device Screen and then show the Select BitBar Device dialog.

  3. If the current TestComplete project does not have a BitBar API key specified, to connect to the BitBar device cloud dialog, enter the API key.

    Learn how to get the API key

  4. On the Parameters tab, select the mobile device and a tested application for which you want to open a testing session.

    The Found devices list contains all the devices that are available for you in BitBar and that match the search criteria. If needed, you can filter the list by using the Device Type, OS Version, Resolution and Quick Search filters. Select the device to which you want to connect.

  5. In the Application drop-down list box, select a mobile application for which you want to open a testing session. The application file must be either stored in the BitBar Files Library or added to the Tested Applications of the current TestComplete project. In the latter case, click Upload to BitBar to upload the application file to the BitBar Files Library and then select it in the list.

  6. If needed, on the Custom parameters tab, you can specify additional capabilities to be used for the testing session. Specify the capabilities in the JSON format. For example:

    JSON

    {
      "bitbar_project": "Automated tests",
      "bitbar_description": "Testing the Orders app"
    }

    The will validate the JSON code as you are typing it.

    Note: The capabilities you specify on the Custom capabilities tab can overwrite values specified on the Parameters tab.

    For the list of available capabilities, see the BitBar Documentation - Desired Capabilities.

  7. Click OK.

On mobile devices controlled by a private server

  1. Click Show Mobile Screen on the TestComplete toolbar.

    Note: If the button is hidden, you can make it visible as it is described in Customizing Toolbars and Menus.

  2. TestComplete will open the Mobile Device Screen and then show the Select BitBar Device dialog.

  3. In the dialog, click Local Appium.

  4. In the Server URL text box, enter the URL address of your Appium server.

  5. In the Application Path text editor, specify the full path to the application that you want to install on the target mobile device and from which you want to open a testing session. If your application is added to the list of tested applications in your TestComplete project, you can click the down-arrow button and select the application path from the drop-down list. You can also type the path manually, or you can click the ellipsis button and browse for the needed application file.

  6. In the Parameters editor, enter the capabilities that describe a testing session you want to open, in the JSON format. The dialog will validate the JSON code as you are typing.

    View required capabilities

    For information on all available capabilities, see Appium Desired Capabilities.

  7. Click OK.

After TestComplete connects to a testing session, you can access your tested mobile application from TestComplete:

  • You can view and explore your application in the Mobile Screen window and capture individual objects with the Object Spy:

    Capturing objects in a tested mobile application with the Object Spy

    Click the image to enlarge it.

  • You can explore your application and its object hierarchy in the Object Browser:

    Exploring a tested mobile application in Object Browser

    Click the image to enlarge it.

    Note: The Object Browser shows the image of selected objects, which makes the search easier.

3. Record user actions

  1. Start recording in any way you find suitable. See Recording Automated Tests.

  2. TestComplete will show the Recording toolbar.

  3. In the Mobile Screen window of TestComplete, interact with your tested application as an end-user would: click the controls, input data into forms, and so on.

  4. Stop the recording.

TestComplete will process the recorded actions and generate the test. The images below show an example of a recorded mobile test:

A keyword test

Recorded mobile test

Click the image to enlarge it.

A script test

Recorded mobile test

Click the image to enlarge it.

A test consists of the sequence of operations that define various interactions with objects in the tested mobile application.

You can modify and enhance the recorded test in a number of ways to make it more flexible and efficient. For example:

  • Add new operations, reorder operations and modify their parameters.

  • Delete or disable unneeded operations (for example, superfluous recorded operations).

  • Insert checkpoints for verifying objects and values in the tested application.

  • Create data-driven tests that run multiple test iterations using different sets of data.

4. Close the session and disconnect from the server

If needed, you can close your current testing session and disconnect from the mobile device. To do this, use the Mobile.Device(<Device_Name>).Disconnect method. To call the method from a keyword test, you can use the Call Object Method, Run Code Snippet, or Run Script Routine operation.

See Also

About Mobile Tests

Highlight search results