Customize the iOS Simulator for Test Automation
How to use command line tools to configure the simulator
In mobile app development, test automation is becoming a must for apps that require frequent release. Creating a custom iOS simulator is a prerequisite for test automation. It often involves configuring various settings like region, language, keyboard configuration, and accessibility settings.
I will discuss how to create and configure an iOS simulator programmatically in this article.
Create a simulator with simctl
simctl is an Apple tool that interacts with iOS simulators from the command line. It is available after the installation of Xcode. You can use it to manage a simulator, install apps for the simulator and perform other actions. To find out the options of the tool, use the following command.
xcrun simctl --help
To create a new simulator, run the following command
xcrun simctl create “my first simulator” “iPhone X” com.apple.CoreSimulator.SimRuntime.iOS-14–5
It creates an iPhone X simulator with iOS version 14.5 and also outputs the UDID of the new simulator. The UDID is a unique identifier for a simulator. We need it in all commands applicable to a device.