Introduction
Appium Setup
RequirementsInstall NPM and Node.jsInstall JavaInstall Android SDKInstall Android Platform ToolsInstall XCodeInstall AppiumSetting Up AndroidSetting Up iOSSetting Up An EmulatorSetting Up WindowsCompiling Your App (Native Apps)Compiling Your App (Hybrid Apps)Setup A Code Editor
MoQuality Tutorials
MoQuality Dashboard
Integrations
Common Issues

Requirements

Appium has the following requirements:

  • Node.js and npm
  • Java Development Kit (JDK)
  • Android SDK > 16
  • Android platform tools (for adb)
  • Android build-tools (for aapt)
  • Appium

If you want to test iOS apps, you also need XCode. On top of that, if you want to test on a local iOS device you need to have a valid Apple developer account.

Follow the step-by-step installation guide to install and verify each of these components.

Install NPM and Node.js

Node.js is a JavaScript runtime. npm is Node Package Manager, which makes it easy for JavaScript developers to share, update and reuse code. npm is distributed with Node.js- which means that when you download Node.js, you automatically get npm installed on your computer.

For Mac:

To install Node.js on a Mac, it is recommended to use Homebrew. A little set-up in the beginning, can save you from some headaches later on!

How to install or verify Homebrew on your computer:

  1. Open your Terminal. Press Command - spacebar to launch Spotlight and type "Terminal," then double-click the search result.
  2. See if Homebrew is installed by running brew -v. You should see “Homebrew” and a version number.
  3. If not, download and install Homebrew with the instructions.
  4. Once you’ve installed Homebrew, repeat step 2 to verify.

Install Node

Run brew install node in the terminal to install Node

Or, download the macOS Installer sourced from the nodejs.org web site.

For Windows:

Simply download the Windows Installer 32-bit or 64-bit sourced from the nodejs.org web site.

Install Java

Java Runtime Environment (JRE): Simply put, JRE is an environment that helps you run Java programs.

Java Development Kit (JDK): JDK would be required if you want to write Java programs. When you install JDK, then both JDK and JRE will be installed on your machine.

You need to have JDK (Java Development Kit) installed and JAVA_HOME set in your environment.

  • Download JDK 8. Our recommendation is to update to the most recent version of Java 8 to avoid issues with Appium. You can have multiple versions of Java also.
  • Ensure that the JAVA_HOME environment variable is also set to the JDK path.

For Mac

  1. Determine whether Java is installed by using the command which java
    You will see something like this - "/usr/bin/java"
  2. Next Step will be to determine the version of Java Installed by using the command java -version
    You will see something like java version "1.8.0_241". The latest version as of January 27, 2020, is "1.8.0_241".
  3. Next step will be to get the location where the Java is installed: cd /Library/Java
  4. Under the Java folder, select the folder with the version that was displayed earlier: /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
  5. Next check if Java_Home is setup to the correct location: echo $JAVA_HOME
    It will result in blank output if it is not already setup. If it returns the location, check if it points to the correct folder.
  6. You can add or update the Java_Home using the below commands (depending on which shell you use):
    vi ~/.bash_profile
    OR
    vi ~/.zshrc
  7. Navigate to the end of the file by pressing "Shift + g". Now press "i" to get to insert mode. Add the below lines in the bash_profile after replacing the path to the java home directory on your mac
    # Setting Java_Home
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
    Save this by pressing Esc followed by ":wq!"
  8. Finally, open a new terminal window and test the variable is setup correctly:
    echo $JAVA_HOME
    It should return the Java_Home path setup

Reference (For Mac)

For Windows

  1. Download the latest Java 8 version from the JDK Downloads page. On this page, Accept License Agreement and then download the JDK for Windows based on whether you have Windows 32-bit or 64-bit operating system.
  2. Run the downloaded .exe file and start installation process. We recommend using default options for Java installation.
  3. To verify that the installation is successful, open Java folder in Program files. You would see that new JRE & JDK folders with the latest version numbers have been created. Don’t worry if you see previous versions of JRE or JDK folders in there. Multiple versions of JDKs & JREs can co-exist.
  4. Copy the folder location where the latest version of JDK is installed. For a 64-bit system, this would look like - C:\Program Files\Java\jdk1.8.0_241 where 241 is the latest java version.
  5. You have to now open the environment variables window in your machine. To do this, click on the Start menu. Then right-click on Computer and select Properties option. Click on Advanced System Settings option.
  6. Now from the Advanced Tab, click on the Environment Variables button. Set the following user environment variables.
JAVA_HOME : C:\\Program Files\\Java\\jdk1.8.0_241
JDK_HOME : %JAVA_HOME%
JRE_HOME : %JAVA_HOME%\\jre
CLASSPATH : .;%JAVA_HOME%\\lib;%JAVA_HOME%\\jre\\lib
PATH : your-unique-entries;%JAVA_HOME%\\bin (make sure that the longish your-unique-entries does not contain any other references to another Java installation folder)

Notice that these environment variables are derived from the "root" environment variable JAVA_HOME. This makes it easy to update your environment variables when updating the JDK. Just point JAVA_HOME to the fresh installation.

  1. Verify the installation. Open a command prompt. Run the command javac -version. This should show the javac version number. Verify that this version number is the same as the latest JDK version (from JDK folder name). You can also run the command where javac. This command should show the JDK bin folder location. This should be the same folder location that you had set in the Path variable

References (For Windows)

Install Android SDK

If you want to set up for Android, you need to install the Android SDK and set up ANDROID_HOME. There are 2 different ways in which you can download and install Android SDK tools –

  • By downloading Android Studio: Android Studio is the official IDE for creating Android apps and running Android Virtual Devices. When you install Android Studio, SDK tools come bundled with it
  • By downloading Command Line tools: If you do not need Android Studio, you can download the basic Android command-line tools. It comes with sdkmanager, using which you can download other SDK tools and packages

For Mac

Command Line Tools only

  • Install android from the command line tools as follow.
brew tap caskroom/cask\nbrew cask install android-sdk

Android Studio

  • Download and Install Android Studio. Download and run the dmg for Mac (64-bit).
  • Set the ANDROID_HOME environment variable to match this path. For example, if you installed the SDK to /usr/local/adt, then there will typically be an SDK folder inside of that which contains the SDK files. Add the following line to your login script (~/.bash_profile):
export ANDROID_HOME=\"/usr/local/adt/sdk\"\n

For Windows

Android Studio

  1. Download and Install Android Studio. Download and install the 32-bit or 64-bit version depending on your Windows OS version.
  2. Follow the instructions in the installation wizard and use default options to complete the installation.
  3. Next, the main Android environment variables that you would have to set are ANDROID_HOME and Path variables.
  4. By default, Android SDK is installed in this folder – C:\Users\<YourUserName>\AppData\Local\Android\sdk. Go to this folder and verify it. Copy this folder path.
  5. Open the System Properties window. Now from the Advanced Tab, click on Environment Variables button. Set the following user environment variables:
ANDROID_HOME : C:\Users\<YourUserName>\AppData\Local\Android\sdk
PATH : your-unique-entries;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%ANDROID_HOME%\tools\bin

References

Install Android Platform Tools

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. adb is included in the Android SDK Platform-Tools package.

Install using the command line:

Run these commands. For example, here's how to install the latest platform tools (which includes adb) and the SDK tools for API level 28:

sdkmanager "platform-tools" "platforms;android-28"
sdkmanager "platform-tools"

Install manually using Android Studio

  1. Open any existing project in Android Studio, or create a new sample project
  2. Once your Android Studio project is opened, go to Tools > SDK Manager
  3. Under the SDK Tools tab, select these two packages: Android SDK Platform-Tools Android SDK Build Tools

Click Apply or OK to download.

Verify

Verify by running this command adb devices. This will show you any devices that are currently plugged into your machine.

References

Install XCode

Xcode includes everything developers need for iOS apps.

Follow the steps below to install XCode. You will need an Apple Developer account for testing on real iOS devices locally. When prompted to log in, you should be able to use the same email and password you use for your Apple Developer Account. If you don't have a developer account then you will only be able to run tests on virtual iOS devices (Simulators) using your Apple ID.

  • Click on this link to Xcode on the Mac App Store, then click on "View in Mac App Store"
  • It should automatically launch the "App Store" app on your Mac and take you to the Xcode page. Click on the "Free" button, then click on "Install App."
  • Once the installation is complete, go to your Applications folder and double-click on Xcode, then install any required components if asked to.
  • Go to Xcode's Preferences via the menu bar, or by pressing the command and comma keys.
  • Click on the "Downloads" icon, then click on the "Install" button next to "Command Line Tools."