[Mobile] iOS setup (Real devices)
This article shows you how to set up real iOS devices to test iOS applications with Katalon Studio.
To begin with, you need to set up a macOS environment. You can not execute iOS mobile testing in Windows or Linux.
Part 1: Install Xcode
-
Install Xcode version 10.2 or newer. You can download Xcode from the App Store or the Apple Developer website: Xcode.
Notes:
- Xcode must support the current version of your iOS device.
- Katalon Studio can only support iOS version 9.0 or above. To learn more about the supported environment in Katalon Studio, you can refer to this document: Supported environment.
Part 2: Install Appium, Xcode command-line tools, and other iOS dependencies
Install with built-in tools
From Katalon Studio version 8.3.0 onwards, you can install Appium, Xcode command-line tools (Xcode CLT), and other iOS dependencies via Katalon built-in tools. To do so:
-
Open Katalon Studio and go to Tools > iOS > Dependencies.
-
Katalon will automatically install the latest version of Xcode CLT, Appium, Homebrew, NodeJS, and other iOS dependencies.
Install manually
-
Install the Xcode command-line tools. You can download the command-line tool compatible with your Xcode version from the Apple Developer website here: Downloads.
Alternatively, you can copy and paste the following command-line arguments in this order in the Terminal to install the Xcode CLT:
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
-
Download and install Node.js from the Node.js website: Node.js Downloads.
Notes:
- Make sure you install Node.js into a location where you have full Read/Write permissions.
-
Install Appium version 1.12.1 or newer via NPM. To install the latest Appium version, copy and paste the command-line argument as follows:
npm install -g appium
Notes:
- We recommend installing the latest Appium version.
To learn more about Appium, you can refer to the Appium document here: Getting started.
-
Install Homebrew. Homebrew is a package manager that makes it easy to install extra dependencies. To install Homebrew, follow the instructions on the Homebrew website: Homebrew.
-
After installing Homebrew, you can now use it to install the following dependencies in the Terminal:
-
ios-deploy version 1.9.4 or newer. You can learn more about ios-deploy in this Github project: ios-deploy. To install ios-deploy via Homebrew, copy and paste the command-line argument as below:
brew install ios-deploy
-
usbmuxd version 1.0.10 or newer. You can learn more about usbmuxd in this Github project: usbmuxd. To install usbmuxd via Homebrew, copy and paste the following command-line arguments in this order:
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
-
libimobiledevice version 1.2.0 or newer. You can learn more about libimobiledevice on the libimobiledevice website: libimobiledevice. To install libimobiledevice via Homebrew, copy and paste the following command-line arguments in this order:
brew install --HEAD libimobiledevice
brew unlink libimobiledevice
brew link libimobiledevice
-
For Appium versions older than 1.20.0, you need to install Carthage. You can learn more about Carthage in this Github project: Carthage. To install Carthage via Homebrew, copy and paste the command-line argument below:
brew install carthage
-
For Appium versions older than 1.15.0, you also need to install ios-webkit-debug-proxy. You can learn more about ios-webkit-debug-proxy in this Github project: ios-webkit-debug-proxy. To install ios-webkit-debug-proxy via Homebrew, copy and paste the command-line argument as below:
brew install ios-webkit-debug-proxy
-
Part 3: Set up real iOS devices for mobile testing in Katalon Studio
Requirements:
- You have enrolled in the Apple Developer Program. To learn more about the Apple Developer Program enrollment, you can refer to this Apple document: Enrollment.
-
Any device for development with Xcode must be listed in the Apple Developer Portal. To learn about listing your device in Apple Developer Portal, you can refer to this wikiHow document: How to Add a New Device to Your Apple Developer Portal.
-
In Xcode > Preferences > Account, click Add (+) to enter your Apple Developer Account ID and password.
-
Connect your iOS devices to your computer via a USB cable. Confirm to accept or trust the phone.
-
To enable UI Automation on the device, navigate to Settings > Developer. In the UI Automation section, turn on the setting for Enable UI Automation.
-
If you want to execute your tests using Safari on iOS (mobile browser), you will need to enable the following settings in Settings > Safari > Advanced:
- JavaScript
- Web Inspector
- Remote Automation
Part 4: Install the WebDriverAgent
The WebDriverAgent is a WebDriver server used to control iOS devices remotely. To install the WebDriverAgent, you can refer to this document: Install WebDriverAgent for iOS devices.
Part 5: Distribute your app for testing on registered devices
To distribute your app for testing on registered devices, you need to archive and export an .ipa
file. Do as follows:
Prepare your app for distribution
-
Open the project file with Xcode. For example, to open
Coffee Timer.xcodeproj
, from where you store the project > App > Your-First-iOS-App > Coffee Timer. Double-click theCoffee Timer.xcodeproj
file. -
After opening the project in Xcode, select a registered iOS device to launch the apps.
-
In the General tab, set deployment iOS version and select device type in the Deployment Info section.
-
Switch to the Signing & Capabilities tab, check the Automatically manage signing box, then choose the team that has your device registered in the Apple Developer Portal.
By choosing the Automatically manage signing box, Xcode manages code signing assets for you. To learn more about automatic signing, you can refer to this Apple document: Automatic signing.
-
To build the
.ipa
file, click Product > Build.
Create an archive of your app
To archive the .ipa
file, click Product > Archive. If the archive builds successfully, it appears in the Archives organizer.
Notes:
- You can’t create an archive if you set the run destination to a simulator.
Export your app using an ad hoc or development provisioning profile
When you export the app, Xcode re-signs the app using the code signing assets that you choose. To learn more about the distribution method, you can refer to this Apple document: Distribution method.
-
To open the Archives organizer, choose Window > Organizer and click Archives.
-
Select the archive you want to export, then click Distribute App and follow the instructions to get the
.ipa
file. Here, we choose a development provisioning profile to export theCoffee Timer.ipa
file.Click the gif to enlarge it
Install the app on user devices
To verify the .ipa
file, follow these steps:
-
Open Xcode, then navigate to Window > Devices and Simulators.
-
Choose your device from the Devices list.
-
Click Add (+) to browse the
.ipa
file. -
Once installed successfully, the application appears in the Installed Apps section.
After the above steps, you can now execute mobile testing with real iOS devices. To learn more about creating and executing iOS mobile testing in Katalon, you can refer to this document: Create your first iOS test case.
See also:
- Troubleshoot automated mobile testing
- Learn more with our Katalon Academy course: Solve Mobile Testing Challenges with Codeless Solution