We have hundreds of devices that run UI and unit tests. The tests are written using the XCTest framework and run in our applications, as well as in the system (Safari / Configuration) and third parties.
As part of the test framework, we must take the devices to a certain state before running each test. This includes clearing caches, changing configuration items, installing applications, etc. We currently use a combination of Apple Configurator, MDM, configuration profiles and UI tests to reach the desired state for each test.
So far so good, but the entire configuration process is really expensive, unstable and difficult to maintain in different versions of iOS.
Then we thought, why not use backup copies? We can save a backup for each desired initial state, restore the desired backup and start the test immediately.
There is a small problem with that idea: the restoration from the backup takes the device to the "Configuration" state, where the user's manual intervention is required. Even if we use the Apple Configurator to gain the confidence of the device, configure the WiFi and omit all the possible configuration elements, the user must still click on the start button once on the "Hello" page, and then click in "Start" on the screen to Access SpringBoard and be able to start the startup or debug XCTest / application.
It is obvious now: can we somehow automate the entire flow described above? That is: restore an iOS device from the backup, skip the configuration and run XCTests.