XCUITest Automation Benefits

One of the benefits of XCUITest over Appium is that this framework is fully developed, led, and maintained by Apple. It is always up to date with recent features of the iOS operating system.

And because this framework is embedded into the XCode IDE, which is the de-facto development environment for iOS native and hybrid apps, it is easy to get started with. In addition, executing XCUITest automation scripts is fast due to its unique architecture.

With XCUITest, a developer who creates a mobile iOS app can easily generate an iOS automation test suite. This suite co-exists within the same native application project. The test suite is then converted into an iOS IPA package when the app is built.

Both the app package IPA and the test suite IPA are launched when the test is run. This allows the test IPA to execute on the app IPA, contributing to a fully-synchronized run.

An iOS application developer or tester that wants to start testing their app would need to select the Product > Build For > Testing option from the UI to generate the test IPA package.

xcuitest

Key Features of the XCUITest Framework & Perfecto

The iOS platform continues to be challenging to test and maintain due to the plethora of device configurations. Leveraging XCUITest and Perfecto can benefit developers and test engineers as they expand their white box test automation through the following benefits:

1.    Easy Test Automation Setup & Creation

Connecting your existing XCUITest test scripts written in Swift with the Perfecto cloud is quite simple. Perfecto has created an XCTest Gradle plugin that can be added to the iOS project and help configure the cloud URL and the security token. These are required to connect the test to the cloud.

In addition, through the configuration file (JSON), clients easily specify the devices under test and the Perfecto dependency. 

On the right are the basic parameters that need to be configured in the Build.gradle file for your iOS application project in XCode:

xcuitest

To the left is a sample JSON configuration (configFile.json) file to illustrate what parameters you need to set up to connect XCUITest to the Perfecto cloud.

Once the above settings have been identified, the IPA test file and the application IPA files will be installed and executed on the Perfecto cloud devices. Use the following command to launch the test project via the Perfecto gradle plugin:

xcuitest

In case you want to leverage your existing KIF/EarlGrey tests as well, please refer to this documentation to learn how.

xcuitest

2.    Stable Test Execution in the Cloud

Because the entire execution of XCUITest test automation runs in the Perfecto cloud, it is guaranteed that the execution will be 100% stable on clean and secured iOS devices. Perfecto fully supports executing the tests either from MacOS XCode, a Windows machine via a Gradle command, or through Jenkins CI. 

xcuitest

3.    Scalable Testing in Parallel & Enhanced Coverage

In addition to execution stability, the Perfecto cloud hosts over 10,000 different smartphones and tablets, allowing teams to extend their test automation coverage and scalability. Running XCUITest tests across multiple real and virtual devices is fully supported and allows teams to identify iOS device-specific issues across multiple configurations.

xcuitest

4.    Detailed Reporting & Fast Feedback

Like with any test execution in the Perfecto cloud, clients receive a detailed test execution report. The report includes screenshots, videos, logs, and failure root cause analysis classification. This capability helps eliminate noise. It allows teams to focus only on the real defects in the iOS app under test. With the fast execution that XCUITest facilitates and the fast feedback that Perfecto Smart Reporting provides, teams can deliver more quality apps faster.

xcuitest

Getting Started: How XCUITest & Perfecto Work Together

Get started testing with the XCUITest framework and Perfecto.

You can view a sample project here. And XCUITest documentation can be found here.

xcuitest

Try Testing With XCUITest & Perfecto