Boost iPad App Testing Efficiency with Xcode UITesting and CI Integration
This guide explains how to adopt Xcode’s UITesting framework for iPad applications—COOHOM, KuJiaLe Cloud Design, and Enterprise Cloud Design—detailing setup, test case creation, execution, code coverage collection, and seamless integration with GitLab CI to automate testing and reporting.
Background
Currently there are three iPad iOS apps—COOHOM, KuJiaLe Cloud Design, and Enterprise Cloud Design. Because each release requires extensive regression testing, an automated solution is needed to improve efficiency. Various mobile automation tools exist (Appium, UI Testing, KoolTest, Macaca, etc.), and UI Testing (UITesting) best satisfies the UI automation needs.
Apple introduced a new UI testing tool based on Xcode 7+
Supports recording functionality
Allows scripts written in Objective‑C or Swift
Built on the XCTest framework
Uses Accessibility for element location and provides an Accessibility Inspector
Generates test reports and supports coverage statistics
Since the iPad already has an automatic packaging process, using UITesting enables rapid continuous integration, so UITesting was chosen as the UI automation framework.
Implementation Process
1. Using UITesting in the project and writing test cases
Open the project with Xcode.
Add a new UI Test target (New UI Test Target). Xcode creates a COOHOMUITests folder with a default COOHOMUITests.swift file where test cases are written.
Typical test lifecycle methods: setUp() runs before all test cases for common initialization. tearDown() runs after all test cases.
Test methods start with test, e.g., testExample().
Run test cases via Product → Test or the shortcut Cmd+U.
After execution, Xcode shows green checkmarks for passed tests and red crosses for failures.
Collect code coverage:
Add XcodeCoverage pod: pod 'XcodeCoverage', '~> 1.0', then run pod update and pod install.
In Xcode scheme editor, enable Test → Code Coverage.
Run tests again to view coverage reports.
Demo test case screenshot.
2. Integrating with GitLab for CI
Add test execution commands to .gitlab-ci.yml.
Configure Fastfile to run UI tests.
Configure Fastfile to collect code coverage.
Upload test results, reports, and coverage to a display platform via script.
3. Displaying final test results
After test execution, store result data (coverage and pass rate) in a database via API.
Copy test and coverage reports to the deployment machine of the testing platform so they can be accessed via direct links.
Add a front‑end page on the testing platform to show result data and report links.
Final outcome screenshot:
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
