Appium Setup for MAC OSX - SudhiHathwar/Appium-Setup-Guide GitHub Wiki

Welcome to the Appium-Setup-Guide wiki!

Xcode

Download and install Xcode (latest version) from Apple App Store. You don’t need any apple developer account to do that.

Install Homebrew

Open a terminal and run below command Command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install JAVA

Download and install JDK from here Set JAVA_HOME in bash profile.

Install Node

Download and install node from here Or install from brew using the following command: brew install node

Install Android Studio

Download and install Android studio from here

Install Carthage

If running tests on IOS devices, then install carthage via brew using following command brew install carthage

Install Appium

Install Appium Desktop from [here] (http://appium.io/) Or from terminal using the following command: npm install -g appium

To verify whether the appium setup run the following commands

  1. npm install -g appium-doctor
  2. appium-doctor --android

And make sure all the checks are green. If anything is missing, please install via brew.

Once all the pre-requisite are done,

  1. For Running tests on Android follow below steps:
  • Connect android device via USB or boot up the emulator from Android Studio.

When running your tests in parallel mode, make sure you provide the device name and device udid correctly for respective test cases.

(Note: When running tests in parallel mode on emulator, device name is sufficient. Need not to have udid)

Eg: Desired Capabilities for Android

DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "appium/UIAutomator2"); capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName); capabilities.setCapability("udid", udid);

We can get the device name and android device udid via following command

Command: adb devices.

  1. For Running tests on iOS follow below steps:

When running your tests in parallel mode, make sure you provide the device name, OS version and device udid correctly for respective test cases.

  • Launch Xcode and open WebDriverAgent.xcodeproj from below path /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent

  • Signin all the modules and build the project for testing

  • Once done, connect any devices or select any simulators in Xcode and Click on Test under Product menu on the top. Once the WebdriverAgent installed, click on stop button under product menu.

This completes the installation of WebDriverAgent in connected device or selected emulator and we are good to run tests on iOS devices

Eg: Below is the same capabilities for iOS automation.

DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCuiTest"); capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.IOS); capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName); capabilities.setCapability("wdaLocalPort", Integer.valueOf(wdaLocalPort)); capabilities.setCapability("udid", udid);

We can get the device udid from itunes.