Testing iOS Applications - Overview

Applies to TestComplete 14.0, last modified on January 23, 2019

TestComplete supports testing of mobile applications built for the iOS operating system. This topic helps you get acquainted with the iOS testing functionality supported by TestComplete.

Supported iOS Versions, Devices and Applications

TestComplete supports the following iOS applications, devices and iOS versions:

  • Devices

    • iPhone 5, 5S, 6, 6 plus, 6S, 6S plus, SE, 7, 7 plus, 8, 8 plus, X, XS, XS Max, XR

    • iPad 4

    • iPad Air, Air 2

    • iPad mini 1–4

    • iPad Pro (1st and 2nd generations)

  • iOS Versions

    • 12.0–12.1

      Note: If you have TestComplete version 12.60, you can enable support for iOS versions 12.0 and 12.1 by installing the appropriate patches.
      By default, TestComplete checks for available patches and suggests installing them automatically. You can also select Help > Check for Updates from the TestComplete main menu to get the patches and install them manually.

    • 11.0–11.4

    • 10.0–10.3.2

  • Application types

    • Objective-C applications (created in Xcode 8–10)

    • Swift applications (created in Xcode 8–10)

    • Xamarin.Forms iOS applications,
      Xamarin.iOS applications

      TestComplete recognizes Xamarin.Forms controls and provides special wrapper test objects to simulate user actions on them. See About Xamarin.Forms Application Testing. Controls of Xamarin.iOS applications are supported as “native” iOS controls.

    TestComplete recognizes controls in Objective-C, Swift and Xamarin applications in the same way and displays the same internal structure of the application.

Unsupported Features

The following applications and features are not supported and cannot be automated:

  • Built-in iOS applications (Calculator and others)
  • Working with the iOS home screen (SpringBoard)
  • Multi-touch gestures
  • 3D Touch
  • Split view
  • Safari View Controller (SFSafariViewController)
  • Any applications that are not prepared for TestComplete

Requirements

Before you start creating and running automated tests for iOS applications:

  1. Add all test devices to the application’s provisioning profile. For instructions, see Registering iOS Devices for Testing.

    Note: This step is needed only for the members of the iOS Developer Program. It is not needed for the iOS Enterprise Developer Program.
  2. Instrument your application in one of the following ways:

    • In TestComplete - First, export the developer certificate files from your Mac computer by following the instruction from the Getting Certificate Files topic, and then add your .ipa file to the list of tested applications. For detailed instructions, see the Instrumenting iOS Applications in TestComplete UI topic.

    • In Xcode - Compile your iOS application in Xcode with specific build settings and with the TestComplete Agent library shipped with your current TestComplete version. For detailed instructions, see Preparing iOS Applications.

    After you update TestComplete, you need to reinstrument the tested application for the new TestComplete version.

    If you use TestComplete 14.0 with applications instrumented for previous TestComplete versions, your device may stop responding. If this happens, restart the device by holding down the power and home buttons for about 10 seconds.

  3. Install the latest version of iTunes on the TestComplete computer. For more information, see Preparing Test Computers and TestComplete for iOS Testing.

  4. Connect your iOS device to the TestComplete computer via USB cable.

  5. Deploy your iOS application on the device. You can do this:

    • Using TestComplete (see Deploying iOS Applications to Devices).

    • By downloading and installing the application (.ipa file) from an internal web server (the so-called ad hoc over-the-air deployment).

  6. Before testing a geolocation application, allow it to access the device’s GPS data:

    • On your device, invoke the "AppName" Would Like to Use Your Current Location popup window. You can do this from TestComplete by viewing the Mobile.Device("MyDevice").GPS.Location property in the Object Browser or by running the following code:

      JavaScript, JScript

      Mobile.Device("MyDevice").GPS.Location;

      Python

      Mobile.Device('MyDevice').GPS.Location

      VBScript

      Mobile.Device("MyDevice").GPS.Location

      DelphiScript

      Mobile.Device('MyDevice').GPS.Location;

      C++Script, C#Script

      Mobile["Device"]("MyDevice")["GPS"]["Location"];

    • Touch OK to allow TestComplete to access the device’s GPS data. This popup window will not appear again until you reinstall the application.

Creating and Recording Tests for iOS Applications

In TestComplete, mobile tests can be recorded or created manually in form of keyword tests or scripts. It is usually easier to record the test first and then modify and enhance the recorded test.

When you record a test, you interact with the tested iOS application as an end-user would: navigate through the application’s screens, fill out forms and so on. TestComplete captures all actions you performed in the application and adds them to the test.

A test consists of a sequence of operations with the device and objects of the tested application. For example, the following keyword test uses the TouchItem operation to select an item from a combo box, and the SetText operation to simulate text input into text boxes.

A recorded iOS test in TestComplete

The recorded tests can be modified and enhanced in a number of ways to create more flexible and efficient tests. For example, you can:

What Your iOS Tests Can Do

With TestComplete, you can create iOS tests that perform the following actions –

To simulate test actions on application controls, you can use control-specific methods and properties that TestComplete provides for iOS controls, as well as native methods and properties of the controls. For complete information on simulating user actions and performing other test operations, see Simulating User Actions on iOS Applications.

What tests currently cannot do –

  • Simulate user actions outside of the tested application. For instance, a test cannot touch the SpringBoard screen.

  • Simulate user actions on applications that were not prepared for testing with TestComplete. For example, you cannot simulate user actions on the Calculator application that is built into the iOS operating system.

  • Interact with custom objects, whose class names are not included in Object Mapping. See Addressing Objects in iOS Applications.

  • Simulate multi-touch events (gestures).

  • Simulate 3D Touch events.

  • Run an application in Slide Over and switch between primary and secondary applications. See Testing iOS Applications Run in Slide Over.

  • Use split view.

Mobile Screen Window

TestComplete includes the Mobile Screen window that displays the screen of the mobile device, emulator or virtual machine under test.

iOS Testing: The TestComplete Mobile Screen window

When you perform various actions in this window like touches, swipes or keystrokes, TestComplete passes them to the application under test. Similarly, any changes on the application screen are reflected in this window. In other words, you can use the Mobile Screen window to work with the iOS application without accessing the device.

The Mobile Screen window makes the application screen as accessible as your computer’s desktop. For instance, creating a keyword-test operation or checkpoint may require selecting a control from the screen. To do this, you display your application in the Mobile Screen window and then choose the needed control from it in the same way as if you chose the control from the desktop.

Object Hierarchy and Object Properties

The top-level test object for iOS testing is Mobile. It contains methods and properties for accessing and enumerating mobile devices to which TestComplete is connected. You can see these methods and properties in the Object Browser:

iOS Testing: Objects of iOS applications in the Object Browser

Click the image to enlarge it.

The Mobile object has child Device objects that correspond to the connected mobile devices (see the image above). Properties of these objects provide information about the device and the operating system version installed on them. Methods help you simulate various test actions on the device: swipes, keystrokes, pressing physical (on device) buttons and so on.

Below Device there is a Process object that corresponds to your tested application. If there are no prepared applications running on the device, the Device node will have no child nodes.

The object hierarchy below the Process node reflects the hierarchy of application controls. To simplify object hierarchy, TestComplete does not display auxiliary objects (like containers) unless they represent application windows or controls. TestComplete detects controls’ class names and text and uses them to name test objects: Button("Save"), Label("Order"), TextField("Name") and so on. If the object has no text, its name looks like View(""). If there are several objects that contain the same text (or do not contain any text), TestComplete adds indexes to their names to distinguish the objects: View(""), View("", 2), View("", 3) and so on. For detailed information on naming objects, see Creating Tests for iOS Applications.

Support for iOS Controls

TestComplete can recognize controls in iOS applications that were prepared for testing. It detects the control type and provides extended support for most frequently used controls, like buttons, table views, scroll views and others. See Supported iOS Controls.

For supported controls, TestComplete offers specific built-in operations that help you automate various user actions on the controls: item selection, data retrieval, and so on. Some operations can be performed with "native" methods and properties that the iOS applications expose to TestComplete. Topics of the Working With iOS Controls section contain examples that demonstrate how to perform actions on iOS controls.

For information on working with web pages displayed in the WebViews, see the topics of the Testing Hybrid Mobile Applications section.

Verifying Object Properties

To verify properties of iOS application objects, you can use property checkpoints. You can also use region checkpoints to compare the device screen or its part with some base-line image. Creating these checkpoints for iOS applications is very similar to creating checkpoints for Windows desktop and Web applications. You can find detailed descriptions in TestComplete documentation. The only difference is that to specify the object for which you create a checkpoint, you choose this object from the Mobile Screen window.

Samples and Tutorials

TestComplete includes a sample test project that illustrates testing of an iOS application and working with the iOS device’s sensors:

<TestComplete Samples>\Mobile\iOS\Orders

Note: If you do not have the sample, download the TestComplete Samples installation package from the https://support.smartbear.com/downloads/testcomplete/samples/ page of our website and run it.

To get started with testing iOS applications, go through the Testing iOS Applications - Tutorial.

See Also

Testing iOS Applications
Preparing iOS Applications
Addressing Objects in iOS Applications
Creating Tests for iOS Applications

Highlight search results