We have hundreds of devices running UI and unit tests. The tests are written using XCTest framework, and run on our applications, as well as system (Safari/Settings) and third party ones.
As part of the testing framework, we need to bring devices to a certain state before running each test. This includes clearing caches, changing setup items, installing applications etc. We currently use a combination of Apple Configurator, MDM, configuration profiles and UI tests to get to the desired state for each test.
So far so good, but the process of setting everything up is really costly, unstable and hard to maintain across different iOS versions.
Then we thought - why not use back ups? We can save a backup for each desired initial state, restore to the desired backup and start the test right away.
There is one tiny problem with that idea - restoring from backup brings the device to the "Setup" state, where manual user intervention is required. Even if we use Apple Configurator to gain the device's trust, set up WiFi, and skip all possible setup items, the user must still click home button once in the "Hello" page, and then click "Get Started" on screen in order to get to SpringBoard and be able to start XCTest / application launching or debugging.
Is obvious now: can we somehow automate the entire flow described above? That is - restore an iOS device from backup, skip the setup, and run XCTests.