I’ve been playing with AWS Device Farm for the last few days. It’s a neat little service provided by Amazon, especially for those who are interested in automated testing and continuous testing. They make it really easy to go ahead and automate your tests against a number of different device / OS flavors. While useful on iOS, this becomes especially useful on Android where different devices and manufactured have a very wide range of possible configurations.
But this post isn’t so much to detail the usefulness of the tool – it probably speaks for itself. It’s written with the intent of surfacing a few gotchas in setting up and executing tests on AWS Device Farm that kind of slip through the cracks with Amazon’s official (and sometimes difficult to surface) documentation / blogs.
Generating a Test Runner App – Fiddling with your Build Schemes
First thing you’ll need to do, and hopefully it’ll save a lot of headache for you, is to setup your Xcode project settings so that it actually builds and exports your Test-Runner.app that you use for your XC UI Tests:
- Go to Product -> Scheme -> Edit Scheme
- Click on Build in the left nav tab
- Select your XCTests and XC UI Tests targets and enable then for ‘Run’ as below
Generating your .IPA Files for your App + TestRunner App
There are a bunch of ways to generate a .IPA file for your app. One of the earliest mistakes I made was to go ahead and do the normal Build -> Archive -> Export IPA flow. This takes FOREVER. So digging deeper into the documentation on Amazon, I found that they expect a different flow.
- Change your Build Scheme to ‘Generic Device’
- Go to Product -> Build For -> Running
- Great! Now go to where your products are stored. The easiest would be to select your .app file from the Products folder in the file hierarchy and then view it under Identity and Type in the file inspector. Click on the little arrow under Full Path and it’ll take you right there.
- Here you’ll see the two .app files of interest.
- Okay, now what about your IPA files? You have .App files! Well according to AWS Device Farm, this is what you do:
- Create a folder named Payload
- Drag and drop the .app file (either the application if you’re uploading the application, or the test runner if you’re uploading an XC UI Test) into the Payload folder
- Zip the folder
- Change the extension to .ipa and confirm the change
The rest is pretty straightforward. Basically you’ll just go ahead and follow the wizard walkthrough and upload things as need be. Hopefully you found this bit pretty helpful. If you’re still running into random issues – check out their forums and blog posts listed below!