How to Automate iOS UI Tests Without MacOS
Dec 5, 2023
Apple runs a closed ecosystem. That means if you're building iOS apps, you almost certainly need access to a Mac.
In the mobile teams I've worked in, the MacBook Pro has long been the de facto choice for iOS dev specialists.
But what about testing? And what about Windows/Linux?
Test automation is a whole team activity
As mobile test automation tooling improves, non-engineers increasingly contribute.
Product managers, UX designers, engineering managers, and manual-focused QAs are more likely to contribute to test automation than ever.
However, these folk are also far less likely to have a MacBook, with Windows remaining the dominant OS for corporate settings (70% market share).
Tech teams are moving away from macOS
But it's not just less techy folk who are Mac-free.
StackOverflow's 2022 Developer Survey shows that Linux (40%) is now second place to Windows (48%) as developers' primary operating system. With macOS trailing on 33%.
Why local test creation probably won't work
Popular open-source testing frameworks such as Appium and Maestro support test execution on both iOS and Android.
If your app has feature parity across iOS and Android, you might be tempted to build your tests using Android Emulators with Windows/Linux and then use these tests on iOS in the cloud.
For very simple apps with well-defined test IDs, this might work.
However, depending on how your app is built, most builds will render small differences in the hierarchy or test steps that will need to be accounted for by platform conditionals:
As Windows/Linux users will be blind to the iOS component hierarchy, you would need to guess the required test changes and then re-attempt validation by uploading the cloud iOS runner.
Relying on this mechanism for real-world iOS test creation and debugging is impractical.
The answer: cloud-based iOS test creation
Traditionally, end-to-end test creation has been a local process, but in order to solve this issue, we need to modernise the approach and work with cloud-based test creation.
What is cloud-based test creation?
To build an end-to-end mobile test, you need three elements:
A virtual iOS or Android device
A way to create a test (either scripted or declarative)
A method to run and debug the test
In cloud-based test creation, all three elements are hosted on the web and accessed via the browser.
The benefits of this are:
No dependency on MacOS
No need to use local processing power
There is no need to set up local emulators or simulators
Less flakiness (as test creation and execution occur in the same environment)
The disadvantages are:
Any local setup (including scripts, etc.) needs to be replicated in the cloud environment
You need to buy a service (like Moropo) to host the environment and tooling for you
How to build iOS without a Mac using Moropo
Moropo lets you create tests directly from the browser using declarative scripting or a no-code UI. You can choose from a variety of iOS or Android devices and OS versions.
Step 1: Register for Moropo
Request a free Moropo account. Please include a reference to iOS so we can unlock it for you during the trial. Otherwise, you'll be stuck with just Andoird 🙈
Step 2: Upload your .app.zip simulator build
Ask your developer to follow these instructions to produce an iOS simulator build. Upload your build into Moropo.
Step 3: Create a new test
Head to "tests" in the left bar and then "write test" to create a new test. This will launch your virtual device and let you start adding test steps.
Start with launchApp and continue to build the rest of your iOS test on any operating system.
Closing notes
If you have Windows or Linux users who need to contribute to your iOS tests, then using a cloud-based test creation environment can offer big benefits over traditional local test creation.
If you want support or advice on your testing setup, message me in the chat below.
Everything you need to know about building iOS UI tests from a Windows or Linux machine.