Building your iOS app for use in the Appium GUI
Appium seems to be the best option out there for functionally testing your iOS apps. However, there doesn't seem to be great documentation on how to get your iOS app built and ready to be used with Appium. Below are the steps it took for me to get it going:
Before We Begin
Before we start, I'm making the following assumptions:
- You have an XCode project already created and running successfully within the iPhone Simulator.
- You have downloaded, installed, and launched the Appium GUI
Build Your App
This one took me the longest to figure out. I'm extremely new to iOS development, so I had only ever run my app within XCode, and didn't know where to find my app's "App Path." Finally, after a ton of Googling, I came across this post from Facebook which gave me enough info.
Step 1: Open up your project in XCode, right-click your Project Name (mine is Brew Notice) and select "Show in Finder."

Step 2: Right-click YourProject.xcodeproj
and navigation to Open With > Terminal
. Now run cd ../
. Your terminal is now sitting in your project's main directory.
Step 3: Determine which iPhone Simulator you can build to by running xcodebuild -showsdks
. This should output something like the following:
OS X SDKs:
OS X 10.9 -sdk macosx10.9
OS X 10.10 -sdk macosx10.10
iOS SDKs:
iOS 8.2 -sdk iphoneos8.2
iOS Simulator SDKs:
Simulator - iOS 8.2 -sdk iphonesimulator8.2
We only care about the "iOS Sumulator SDKs" section. Take note of the versions available to you. In my case, 8.2 is the only one I have currently.
Step 4: Build your app with the following command:
xcodebuild -arch i386 -sdk iphonesimulator{version}
After a few seconds and a lot of text, you should see the text ** BUILD SUCCEEDED **
.
You will notice a new build directory in your project's folder. Locate the file at build/Release-iphonesimulator/YourProject.app
. Remember the location to this file, as we'll be using it soon.
Open the Appium GUI
Step 1: Open the Appium program and click on the Apple icon. This will bring up a dialog titled "iOS Settings."
Step 2: Check the App Path checkbox, and click "Choose." Navigation to the build/Release-iphonesimulator/YourProject.app
file we located in Step 4.
Ensure that the Platform Version
number matches the iOS Simulator version you entered in Step 4 (my version was 8.2).
Step 3: Click the Apple icon again to close the iOS Settings dialog box. Now click the Launch
button. You should see various debug information being spit out. Now click on the Inspector icon (the magnifying glass).
This should load the iOS Simulator with your app in the background. You should see an Appium window similar to this one with your app on the right.
You've now setup your iOS app to run within Appium. Have fun! Question? Get ahold of me @AaronPresley