Prepare iOS test automation

To perform iOS test automation with the Mobile Engine 3.0, you have to first prepare the device or simulator, the Mac, and the mobile application.

Follow the instructions in this chapter to:

Prerequisites for iOS test automation

Test automation on an iOS device or simulator requires the following components:

  • Mobile Engine 3.0 components which are included in Tricentis Tosca standard installation.

  • A computer with Tricentis Tosca.

  • A computer with macOS.

  • Appium components for iOS test automation on the Mac.

  • Xcode and Java installation on the Mac.

  • Android SDK Tools on the Mac if you want to automate Android devices.

  • iOS simulator installed and available on the Mac.

    This component is required even if you execute your test on a real iOS device.

  • An iOS device if you want to execute tests on a real iOS device.

  • For local iOS devices, you need a USB cable to connect the device to the Mac.

  • A valid provisioning profile.

    For detailed information on how to create a provisioning profile, refer to the Apple Developer documentation.

  • Network availability on the computer with Tricentis Tosca and on the Mac.

For detailed information regarding software versions and hardware requirements for iOS test automation with the Mobile Engine 3.0, refer to the System Requirements.

To ensure that the server doesn't time out during iOS test automation, increase the server response time-out. To do so, follow the steps below:

  1. Navigate to Project->Settings->TBox->Engines->Remote server response timeout.

  2. Increase the Value from the default 120000 to recommended 1200000 by adding an additional 0.

Prepare a Mac for iOS test automation

To prepare a Mac for iOS test automation, you have to:

Prepare iOS devices or simulators for test automation

Follow the instructions below to:

The specific location of settings and options may vary depending on your device.

Prepare iOS devices for test automation

To prepare an iOS device for test automation, follow the steps below:

  1. Connect an iOS device to your Mac via a USB.

  2. Accept the connection on your mobile device and on your Mac.

  3. On the iOS device, go to Settings->Developer Settings and switch on the Enable UI Automation option.

  4. Under Settings, go to Safari->Advanced and switch on the Web Inspector option.

  5. Open the Terminal on your Mac and enter the command Appium.

    Leave the Terminal tab open.

    After launching the Appium server on a Mac, the Terminal should display the following information:

[Appium] Welcome to Appium v1.20.2

[Appium] Appium REST http interface listener started on 0.0.0.0:4723

  1. Open Tosca Commander and prepare your TestCases:

  2. Run your TestCases.

Prepare iOS simulators for test automation

To prepare an iOS simulator for test automation, follow the steps below:

  1. Install and set up a valid iOS simulator on the computer where you want to run your TestCases in Tosca Commander.

  2. Open Terminal on your Mac and enter the command Appium.

    Leave the Terminal window open.

  1. Open Tosca Commander and prepare your TestCases:

  2. Run your TestCases.

For the first execution on an iOS simulator using Xcode version 9.4 or later, you have to close all other simulators that are currently active. You can then continue to run tests on the same simulator without closing it.

When you scan or steer controls on an iOS simulator, the default version of iOS must be available on the Mac which you configured for mobile test automation.

If you want to change the version of the simulator that you use for scanning, go to Project->Settings and then go to Tbox->Engines->Mobile30->Default iOS Simulator Version.

Prepare iOS hybrid applications for test automation

To prepare an iOS hybrid application for test automation, you have to:

The mobile application under test has to be signed with a developer certificate.

Configure WebView

To ensure that all clicks within the WebView work correctly, your WebView needs to be in full screen mode.

If you use iOS version 11.0 or later to build your application, you have to define the correct target and architecture.

To do so, follow the steps below:

  1. Open Xcode and click on your project.

  2. Click on the target that you want to modify.

  3. Select your iOS version from the Deployment Target drop-down menu.

Define Deployment Target

  1. Switch to the Build Settings tab.

  2. Select arm64 from the Valid Architectures drop-down menu.

Select architecture

Set the Accessibility properties in Xcode

To scan and steer iOS controls, you have to correctly set their Accessibility properties in Xcode.

To do so, follow the steps below:

  1. Open Xcode.

  2. Set the Accessibility property of the parent container to Disabled.

  3. Set the Accessibility properties of the controls to Enabled.

Enable accessibility to steer native iOS controls in Xcode

Set the accessibilityLabel for ButtonSelector and ListView

To steer the ButtonSelector and ListView controls as xOS Modules, you have to modify their accessibilityLabel property:

  • For ButtonSelector, change the accessibilityLabel under the UISegmentedControl in the code of the iOS application. The value of this property has to match this control's ID in an Android application.

  • For ListView, change the accessibilityLabel under the UITableView in the code of the iOS application. The value of this property has to match this control's ID in an Android application.

Automate iOS hybrid applications in Perfecto

To run tests of hybrid applications in Perfecto, you must set additional Desired Capabilities.

To do so, follow the steps below:

  1. As a first TestStep, add the Set Desired Capabilities Module.

  2. Add the Desired Capability useAppiumForHybrid and set its Value to True.

  3. Add the Desired Capability autoInstrument and set its Value to True.

Desired Capabilities for test automation of hybrid applications in Perfecto

Prepare iOS native applications for test automation

To scan and steer native iOS controls, you have to modify the Accessibility properties of the controls. For detailed information, see the following chapters:

Prepare iOS mobile web applications for test automation

To scan and steer HTML controls in mobile web applications on iOS 12, the app developer must fill in the <title> tag of the mobile web page.

Recommendations for Xamarin applications

With the Mobile Engine 3.0, you can steer applications created with the Xamarin framework. You can use all standard mobile web controls and native controls. This chapter provides information on optimizing Xamarin applications for testing with the Mobile Engine 3.0.

ID Handling of controls

To improve the preciseness of testing, consider the following:

  • On Xamarin Forms: ensure to fill the optional AutomationId parameter. Mobile Engine 3.0 recognizes this parameter as Content Description during scanning, and can use it as the unique ID required for steering the control.

  • On Xamarin Android: ensure to set the ContentDescription parameter. Mobile Engine 3.0 recognizes this parameter as Content Description during scanning, and can use it as the unique ID for steering the control.