- Download and install JDK
- Type
java -version
in your Terminal to verify installation and find out your java version - See the output of java version
- Download and install Android Studio
- Create android emulator using AVD Manager
- Run and stop your emulator
- See android emulator sample
- Install Homebrew using Terminal and enter the following command
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Follow the instructions until Homebrew installing success
- Type
brew --version
to find out your homebrew version - See the output of homebrew version
- Install node.js using brew, type
brew install node
in your Terminal - Wait until node.js installing success
- Type
node --version
to find out your node version - Type
npm --version
to find out your npm version - See the output of node and npm version
- Create and open your .zshrc using Terminal
$ cd ~/ $ touch .zshrc $ open -e .zshrc
- Set the Java and Android SDK paths in zshrc file
export JAVA_HOME=/Library/Java/JavaVirtualMachines/JDK_VERSION_FOLDER/Contents/Home export ANDROID_HOME=/Users/SOME_FOLDERS/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH/:$ANDROID_HOME/platform-tools export PATH=$PATH:$JAVA_HOME/bin
- Save and exit your .zshrc
- Run emulator or connecting your real device
- Type
adb devices
in Terminal to find out name and connection of your devices - See the output of list of devices
- Install Appium with npm in your Terminal using the following command
$ npm install -g appium
- To ensure that we are ready to use Appium, you can run the following command
$ appium-doctor
- Minimum requirements for android testing from appium-doctor
- HOME is set to: /Users/some_folders ✔
- ANDROID_HOME is set to: /Users/some_folders/Library/Android/sdk ✔
- JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk_version_folder/Contents/Home ✔
- adb exists at: /Users/some_folders/Library/Android/sdk/platform-tools/adb ✔
- android exists at: /Users/some_folders/Library/Android/sdk/tools/android ✔
- emulator exists at: /Users/some_folders/Library/Android/sdk/tools/emulator ✔
- Bin directory of $JAVA_HOME is set ✔
- Download Selenium library
- Go to Selenium Standalone Server section
- Go to Selenium Client and Webdriver Language Bindings section
- Download Appium Java Client
- Go to releases menu
- Download new version of Java Client
- Download Gson
- Go to releases menu
- Download new version of Gson
- Unzip all of them, then move to single folder like this
- Download and install Eclipse IDE on your macOS
- Launch the Eclipse IDE
- Create a new java project in Eclipse
- In java setting (create new project), click libraries tab
- Add all external jar files
- gson.jar
- java-client.jar
- selenium-server-standalone.jar
- selenium-java.jar or client-combined.jar
- Add to attachment selenium-java-sources.jar or client-combined-sources.jar in selenium-java.jar
- Finish
- Download and install TestNG in Eclipse IDE plug-in section, see install from update site
- After success installing TestNG, restart your Eclipse IDE
- See the sample of java project
- Before execute your android tests, device must be connected with adb devices and Appium must be opened in your Terminal.
- Find out the app package and app activity in Terminal using the following command
$ adb shell "dumpsys window windows | grep -E 'mCurrentFocus|mFocusApp'"
- See the output result, there are
com.google.android.youtube
as app package andcom.google.android.apps.youtube.app.WatchWhileActivity
as app activity - Finding locators using
uiautomatorviewer
from Android Studio, type the following command in Terminal$ uiautomatorviewer
- See the uiautomatorviewer