I was stuck for 5 months, unable to run tests on real iOS devices. I wish I could point you to one exact configuration or error that was causing this framework/XCTest issue (and many other issues), but I cannot. What I ended up doing is wiping my whole machine and starting the setup process from scratch. It was a gamble because I really didn’t know what I was going to do if that didn’t work, but it did.
While in the process of setting up my environment, I took very detailed notes of exactly what I did, in order. I’ll share this with you. There are some very basic steps in here (i.e. install Chrome, etc.) but I wanted a record of exactly what I did in case I had problems again:
- Install Chrome / Firefox
- Install Xcode
- Install Xcode command line tools (
xcode-select --install
) - Install Homebrew (
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
) - Install Appium GUI // **NOTE: This is obsolete; install Appium Desktop instead
- Install JDK (JDK 8 Update 121) // **NOTE: Not sure what the current version is, but this was most recent at the time
- Install Eclipse (Eclipse IDE for Java Developers) NOTE: I recently switched to Intelli-J. Personal preference.
- Install git (
brew install git
)
- install from git - not from Apple’s fork; see https://www.atlassian.com/git/tutorials/install-git for more details
- Run
git --version
to make sure Apple’s git is not the one being used. If git version indicates Apple, follow instructions for the top-voted answer here: http://apple.stackexchange.com/questions/93002/how-to-properly-update-git-on-mac (Apple’s git is in usr/bin; need to look in the location of official git first)
- Install node with brew (
brew install node
) //** NOTE: I initially installed nodejs from https://nodejs.org/en/, but I later read that it shouls be installed via brew. If you installed from the site and need to uninstall and reinstall with brew, instructions are here - Add
export PATH="/usr/local/bin:$PATH"
to bash_profile - Run
sudo npm install npm -g
to make sure that I got the most recent version of npm - Install Appium (
npm install -g [email protected]
) - Install TestNG in Eclipse (Help -> Eclipse Marketplace)
- Install ideviceinstaller (
brew install --HEAD ideviceinstaller
) - Install appium doctor (
npm install appium-doctor -g
) - Install Carthage (
brew install carthage
)
At this point, you should be able to run tests on the Simulator
- Install ios-deploy (
brew install ios-deploy
) - Install appium-xcuitest-driver (
npm install -g appium-xcuitest-driver
) - Install deviceconsole (
npm install -g deviceconsole
) - Navigate to /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent and run the following:
mkdir -p Resources/WebDriverAgent.bundle
./Scripts/bootstrap.sh -d
- Follow the steps in this video: https://www.youtube.com/watch?v=Yi177Si5aLU (You will have completed some of the steps in this video already, but the main takeaway is the Xcode part - getting rid of errors in WebDriverAgent.xcodeproj, code signing, etc.)
- In the WebDriverAgent folder, run
bash Scripts/bootstrap.sh -d
- Make sure app and developer account are trusted on device (Settings -> General -> Profiles & Device Management)
At this point, you should be able to run tests on real iOS devices
I had an awful time with this and maybe there’s a better way to do it, but this is what finally got me up and running. I wish I knew what was causing this framework/XCTest problem but I never figured it out. Best of luck to you, and if it doesn’t work I’d be happy to help you troubleshoot.