Appium v 1.7.1 setup on Mac OS Sierra for iOS Real device automation
Set up Mac Pc for automation on real device:
Setting Mac PC/Laptop for automation is difficult task if you are new user on unix/linux based system. But if you are familiar with commands and scripts then you can setup the mac system easily for automation as well as programming.
Follow the below steps to set up Mac OS X PC/Laptop for Automation/Programming:
Set terminal to bash profile:
- Set terminal to bash profile (For better editing in terminal)
- Open terminal>Go to terminal preferences> General
- Shell open with set it to Command(Complete Path) to /bin/bash (If it is already set then no need to change)
Show hidden files in Mac OS :
- Open terminal
- Paste the command: defaults write com.apple.finder AppleShowAllFiles YES
- Press Option/Shift + Right click on finder icon
- Relaunch the Finder (All hidden files will get visible)
Setting environment variables in Mac OS :
Install Latest JDK version
- Set Java Home Path using terminal
- echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.profile
Set up Android SDK/(Android Studio)
- Install Android SDK on Application
- Set ANDROID_HOME:
- export ANDROID_HOME=/Users/eXXXXXX/Desktop/utility/AndroidSDK/androidSDK
- Set path of tools and platform tools using Android HOME
- export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Set Maven Path:
- Set maven PATH
- echo export "M2_HOME=PATH where maven downloaded” >> ~/.profile
4. Set Bash Profile.
Run command in terminal vi ~/.profile It should look like as below.
As I kept my softwares on desktop I given my desktop path you can set your own path .
- export JAVA_HOME=$(/usr/libexec/java_home)
- export M2_HOME=/Users/XXXXXX/Desktop/softwares/maven/
- export ANDROID_HOME=/Users/XXXXXX/Desktop/softwares/AndroidSDK/androidsdk
- export PATH=${PATH}:${JAVA_HOME}/bin
- export PATH=${PATH}:${M2_HOME}/bin
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
Setup steps for Appium on Mac Os X:
- Install Xcode latest Desktop version.
- Install Xocde command line (download .dmg or use Command: xcode-select --install)
- Homebrew Install Command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install Node: brew install npm
- Install Carthage: npm install carthage
- Install Appium Command line: brew install -g appium
- Install Appium Doctor: npm install -g appium-doctor
- Install lib: brew install libimobiledevice --HEAD
- Install iOS deploy lib: npm install -g ios-deploy
- Download Appium latest desktop version: https://github.com/appium/appium-desktop/releases/tag/v1.2.7
Set WebDriverAgentRunner for running Test on real iOS device:
- Open terminal and go to folder location
cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
Run command in terminal to download missing dependency:
1)mkdir -p Resources/WebDriverAgent.bundle 2)./Scripts/bootstrap.sh
Open WebDriverAgent Runner project present in Appium installation using Xcode:
/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
- In General> Sign in with developer account
- Create Unique Product Bundle Identifier and set it in build setting of WebDriverAgentLib and WebDriverAgentRunner
- While creating provisioning profile connect your iOS device otherwise provisioning failed.
- Build the project and run WebDriverAgentRunner-non debug via Product > Test
- Finally, you can verify that everything works. Build the project:
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test
If this was successful, the output should end with something like:
Test Suite 'All tests' started at 2017-01-23 15:49:12.585
Test Suite 'WebDriverAgentRunner.xctest' started at 2017-01-23 15:49:12.586
Test Suite 'UITestingUITests' started at 2017-01-23 15:49:12.587
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2017-01-23 15:49:12.588
t = 0.00s Set Up
- To completely verify, you can try accessing the WebDriverAgent server status (note: you must be on the same network as the device, and know its IP address, from Settings => Wi-Fi => Current Network):
export DEVICE_URL='http://<device IP>:8100'
export JSON_HEADER='-H "Content-Type: application/json;charset=UTF-8, accept: application/json"'
curl -X GET $JSON_HEADER $DEVICE_URL/status
- You will get output like:
{
"value" : {
"state" : "success",
"os" : {
"name" : "iOS",
"version" : "10.2"
},
"ios" : {
"simulatorVersion" : "10.2",
"ip" : "https://www.linkedin.com/redir/invalid-link-page?url=192%2e168%2e0%2e7"
},
"build" : {
"time" : "Jan 23 2017 14:59:57"
}
},
"sessionId" : "8951A6DD-F3AD-410E-A5DB-D042F42F68A7",
"status" : 0
}
If you followed all the above steps your Mac OS X setup is done for iOS as well as Android Application automation
QA Lead @ respond.io | Agile Testing Enthusiast | API & UI Automation Expert | Playwright | Selenium | respond.io
4yAmazing, thank you for this article bro.
QA Engineer || Techsouljours
6yHere also one more link for Complete installation of Appium in mac for real device iOS automation https://techsouljours.blogspot.com/2018/08/appium-installation-full-setup-on-mac.html
Leading SDET Team @ Chargebee | SDET | Test Automation | Appium | Python | Selenium | Cypress | Docker | AWS | Jenkins | Enhancing Product Quality | Customer Excellence |
6yGood one